spring validation for conditional constraints
Please let me know if spring validation and/or jsr hibernate validator has support.
I need to hookup bean validation in the controller , preferably using the @valid annotation of the parameter.
For the static constraints, I have the spring+hibernate validator working fine. But, is there a way to achieve the conditional constraints?
Thank you
Using the @ConstraintValidator
annotation this is possible, together with not putting any class level annotations in those two fields as those would apply all the time.
See here an example of an address constraint validator, and further info on the official doc.
链接地址: http://www.djcxy.com/p/61094.html上一篇: Spring MVC注释日期范围验证
下一篇: 用于条件约束的弹簧验证