Java Bean Validation Specification and reference implementation

Source: Internet
Author: User

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> &lt ; 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.