[seam-dev] Seam Validation
Emmanuel Bernard
emmanuel at hibernate.org
Tue Mar 8 04:40:47 EST 2011
Hi Gunnar,
I was reading your doc on Seam Validation
http://docs.jboss.org/seam/3/validation/latest/reference/en-US/html_single/#d0e146
I was thinking that we might be able to go one step further with the "Dependency injection for constraint validators".
Today you ask people to configure the ConstraintValidatorFactory using some XML snippet. How about Seam transparently configure it.
You can do it programmatically at two levels:
1. during the construction of ValidatorFactory
ValidatorFactory factory = Validation
.byDefaultProvider().configure()
.constraintValidatorFactory( new InjectingConstraintValidatorFactory() )
.buildValidatorFactory();
2. or during the Validator construction
validator
.usingContext()
.constraintValidatorFactory( new InjectingConstraintValidatorFactory() )
.getValidator();
WDYT?
More information about the seam-dev
mailing list