1. Apache Bval
Dependency Package: Validation-api-1.1.0.final.jar
Org.apache.bval.bundle-1.1.1.jar
Bval-core-1.1.1.jar
Validator Implementation class: Org.apache.bval.jsr.ApacheValidationProvider
2. Hibernate Validator
Dependency Package: Validation-api-1.1.0.final.jar
Hibernate-validator-5.3.0.alpha1.jar
Validator Implementation class: Org.hibernate.validator.HibernateValidator
Hibernate Validator comes with a basic Chinese-language International messaging resource file
Spring integrated java Bean Validation1, spring does not need to add an initialization validator configuration except to specify validator or specify an internationalized message resource file, and spring automatically identifies the existing validator library<!--enable annotation and specify validator-<annotation-driven validator= "validator"/> <beans:bean id= "Validat Orclass= "Org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" > <beans:property name= " Providerclass "value=" Org.apache.bval.jsr.ApacheValidationProvider "/> <!--if not added by default to Classpath with Validationm Essages.properties--<beans:property name= "Validationmessagesource" ref= "Messagesource"/> </beans :bean> <!--internationalized Message resource file (mainly used for display/error message customization in this system)--<beans:bean id= "Messagesource"class= "Org.springframework.context.support.ReloadableResourceBundleMessageSource" > <beans:property name= " Basenames "> <beans:list> <!--Be sure to navigate to classpath in the Web environment or default to the current web app. <beans:value>classpath:messages</beans:value> <beans:value>classpath:org/hibernate/ validator/validationmessages</beans:value> </beans:list> </beans:property> < ; Beans:property name= "Usecodeasdefaultmessage" value= "false"/> <beans:property name= "defaultEncoding" value= "UTF-8"/> <beans:property name= "cacheseconds" value= "/>" </beans:bean>
Reference: http://jinnianshilongnian.iteye.com/blog/1990081
http://blog.csdn.net/wangpeng047/article/details/41726299
Java Bean Validation Specification and reference implementation