简体   繁体   中英

JBOSS 5 and Spring 3 Validation Annotations

I have been trying to set up Spring 3 annotation-based validation, guided by http://static.springsource.org/spring/docs/3.0.0.RC3/spring-framework-reference/html/ch05s07.html . I am using JBOSS 5.0.1 server; however, upon invoking the @Valid annotation from the Controller. I received errors and found out it will require javax.validation.*;

Upon adding the validation-api-1.0.0.GA.jar (for javax.validation.*), I received complaints about it requiring Hibernate Validator 4+, which in turn requires Hibernate 3.5+. Finally, I discovered that JBOSS 5 does not support Hibernate 3.5+ because it uses JPA-2 and JBOSS 5 is tightly coupled to JPA-1.

At this point, my brain hurts.

Does anyone have a successful example of using Spring 3 annotation-based validation under JBOSS 5?

I finally figured out the answer to this. I basically reverted to using Hibernate Validator 3.1 using this example:

http://wheelersoftware.com/articles/hibernate-validator-3.html

Hope this helps anybody else.

I just wanted to add one more thing. I managed to wire Hibernate Validator 4.01 to JBOSS 5.01. The steps were as follows:

  1. Remove hibernate-validator.jar from the JBOSS common/lib directory
  2. Insert the validation-api-1.0.0.GA.jar, hibernate-validator-4.1.0.Final.jar into your project's WEB-INF/lib directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM