Closed
Description
Manuel Jordan opened SPR-13868 and commented
Hello
I know that @RestController
avoid use or declare @ResponseBody
Just curious if is possible apply for @RequestBody
too
Perhaps it should be automatically applied to always for the first parameter of the method. Therefore leaving free to declare other parameters.
I mean from
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value=PersonaRestControllerSupport.ROOT_URI,
method=RequestMethod.POST,
consumes={MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE})
public ResponseEntity<Void> saveOne(@Validated @RequestBody Persona persona){
to (No @RequestBody
)
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value=PersonaRestControllerSupport.ROOT_URI,
method=RequestMethod.POST,
consumes={MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE})
public ResponseEntity<Void> saveOne(@Validated Persona persona){
In case of many parameters in Rest (Perhaps get the URL, or Header) apply something similar about the following (about Parameter order constrains/restrictions)
public String saveOne(@Validated @ModelAttribute Persona persona,
BindingResult result,
RedirectAttributes redirectAttributes){
Where BindingResult
must be located after of the Entity Model.
Thanks
Affects: 4.2 GA
Issue Links:
- Controller method argument initialized either from the request body or from request parameters [SPR-13742] #18315 Controller method argument initialized either from the request body or from request parameters