Hi,
generally the bootstrapping looks like this:
Code:
HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
config.addMapping( mapping );
ValidatorFactory factory = config.buildValidatorFactory();
Validator validator = factory.getValidator();
I don't know much about the Spring integration and looking only at
LocalValidatorFactoryBean it is hard to be very specific. The class is written to bootstrap any provider really. So if you want to use the programmatic approach you would need to somehow check and cast the
Configuration to
HibernateValidatorConfiguration.
LocalValidatorFactoryBean seems to get passes the whole
ApplicationContext so you should be able to retrieve the constraint mapping from there. Maybe you could override
afterPropertiesSet. That's only an idea. I am not sure how
LocalValidatorFactoryBean comes into play and whether you can easily replace it with your own version.
--Hardy