I'm developping spring-boot application, I need to validate user information before checking other information. This is a snippet:
@RequestMapping(value = "/create-user", method = RequestMethod.POST)
public String ceateCustomer(@Valid @RequestBody User user){
myService.create(user);
}
When the user comes from another route /create-sp-user, I have to re-valid the user:
@RequestMapping(value = "/create-sp-user", method = RequestMethod.POST)
public String ceateCustomer(@Valid @RequestBody User user){
user.setSp(true);
// I tried @Valid user without success
// In my User class if sp = true the field telNumber is mandatory
myService.create(user);
}
Would you have any ideas ?
Best regards