Dependency Validation for Beans via JSR303 Validation Specification [SPR-6565] #11231
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Scott Battaglia opened SPR-6565 and commented
Since Spring Framework 3 includes support for the Bean Validation API it would seem a natural extension to add support for using these annotations for more than just domain validation. The
@Required
annotation is too coarse grained to provide much support for validating APIs. Using a combination of Assert.notNull (or other asserts) in an afterPropertiesSet is rather tedious. Being able to annotation the collaborators with annotations such as@NotNull
, etc. and then having them automatically validated when the container starts would be really useful.We've actually implemented this for CAS, but I'd like to see it available in Spring if possible, as I know we would find it useful for multiple projects (and copying it to each project is probably not a good idea).
Our implementation is here:
https://www.ja-sig.org/svn/cas3/trunk/cas-server-core/src/main/java/org/jasig/cas/util/ValidatorBeanPostProcessor.java
Its relatively trivial. There might be improvements that could be made to it.
Thanks
Scott
Affects: 3.0 RC3
Referenced from: commits d6f4f4c
1 votes, 0 watchers
The text was updated successfully, but these errors were encountered: