Closed
Description
Suresh opened SPR-14149 and commented
xpI am using spring boot as RESTFul service. I have a requirement to combine @PathParam
value with @RequestBody
POJO.
The reason is, I am using hibernate validator to validate the POJO. I can manually merge @PathParam
values in Controller class but the hibernate validator is called before the merge happens.
*Example:
I have a POJO as defined below.
public Class User{
private String id;
private String name;
private String firstName;
....
}
Resource class as defined below:
@RestController
@RequestMapping(value = "user")
public Class UserResource{
@RequestMapping(value = "{id}", method = RequestMethod.PUT)
public String update(@PathVariable String id, @RequestBody @Validated(UpdateValidator.class) User user){
user.setId(id);// Have to avoid this.
service.update(user);
}
}
No further details from SPR-14149