Spring MVC - Why not able to use @RequestBody and @RequestParam together

后端 未结 4 2007
闹比i
闹比i 2020-11-28 03:06

Using HTTP dev client with Post request and Content-Type application/x-www-form-urlencoded

1) Only @RequestBody

URL: localhost:8080/SpringMVC/welcome
B

4条回答
  •  醉酒成梦
    2020-11-28 03:36

    It's too late to answer this question, but it could help for new readers, It seems version issues. I ran all these tests with spring 4.1.4 and found that the order of @RequestBody and @RequestParam doesn't matter.

    1. same as your result
    2. same as your result
    3. gave body= "name=abc", and name = "abc"
    4. Same as 3.
    5. body ="name=abc", name = "xyz,abc"
    6. same as 5.

提交回复
热议问题