[bv-dev] Invoking Configuration#buildValidatorFactory() several times

Gunnar Morling gunnar.morling at googlemail.com
Sun Mar 18 06:09:20 EDT 2012

Hi all,

based on a question in the HV user forum [1] I'm wondering whether
it's legal to invoke buildValidatorFactory() several times on the same
instance of javax.validation.Configuration:

Configuration<?> configuration = Validation.byDefaultProvider().configure();

//set up interpolator, traversable resolver etc.
configuration. ...();

ValidatorFactory vf1 = configuration.buildValidatorFactory();

//further customize configuration for another factory
configuration. ...();

ValidatorFactory vf2 = configuration.buildValidatorFactory();

I'm not sure how often one would do something like this in practice,
but I think we should make clear whether this is a valid use case or
whether a Configuration instance is to be thrown away after invoking

After having a look at the spec and the API documentation I think it's
currently unspecified. Any thoughts?



[1] https://forum.hibernate.org/viewtopic.php?f=9&t=1014788

More information about the beanvalidation-dev mailing list