It's very simple to enable validation on the controller method. The following snippet shows an example of this:
@RequestMapping(method = RequestMethod.POST, path = "/users/{name}/todos")
ResponseEntity<?> add(@PathVariable String name
@Valid @RequestBody Todo todo) {
The @Valid(package javax.validation) annotation is used to mark a parameter for validation. Any validation that is defined in the Todo bean is executed before the add method is executed.