Spring REST multiple @RequestBody parameters, possible?

后端 未结 1 839
孤街浪徒
孤街浪徒 2020-12-05 12:26

I\'ve implemented a Spring RESTful web service. Using Jackson JSON for Object Mapping. I have a method that accepts two parameters.

public Person createPerso         


        
相关标签:
1条回答
  • 2020-12-05 13:13

    I'm pretty sure that won't work. There may be a workaround, but the much easier way would be to introduce a wrapper Object and change your signature:

    public class PersonContext{
        private UserContext userContext;
        private Person person;
        // getters and setters
    }
    
    
    public Person createPerson(@RequestBody PersonContext personContext)
    
    0 讨论(0)
提交回复
热议问题