in the spring in actin fourth edition, Chapter V 5.4.2 check data section, use JSR303 for data verification, but it does not take effect, and there is no error
uses the implementation of hibernate-validator, and gradle depends on:
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String processRegistration(@Valid Spitter spitter, Errors errors) {
System.out.println(spitter);
if (errors.hasErrors()) {
errors.getAllErrors().forEach(System.out::println);
return "registerForm";
}
spitterRepository.save(spitter);
return "redirect:/spitter/" + spitter.getUsername();
}