I am using Spring 4. My form contains the following variables:
@NotNull
@Email
private String email;
@NotNull
private String firstName;
@NotNull
private Stri
I had a similar problem and in my case it was sufficient to just add dependency for hibernate validator: org.hibernate:hibernate-validator:5.2.4.Final.
The validation is done by LocalValidatorFactoryBean bean and documentation about it comes handy (here).
Yet at the same time it is worth mentioning that you do not have to instantiate LocalValidatorFactoryBean explicitly as long as you use @EnableWebMvc annotation : http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-config-validation
By default use of @EnableWebMvc or automatically registers Bean Validation support in Spring MVC through the LocalValidatorFactoryBean when a Bean Validation provider such as Hibernate Validator is detected on the classpath.
Hope this helps.