[bv-dev] Invoking Configuration#buildValidatorFactory() several times
Matt Benson
mbenson at apache.org
Mon Mar 19 12:21:29 EDT 2012
Hi Gunnar,
I agree that nothing is specified, and therefore that my default
understanding would have been (and in fact was and is) that there is
no reason a Configuration cannot be reused to build another
ValidatorFactory. The fact that Configuration and ConfigurationState
are separate interfaces seems to imply this as well, albeit subtly. I
could believe there might be a use-case for building a number of
ValidatorFactory instances, each with e.g. one configuration property
modified from the last.
$0.02,
Matt
On Sun, Mar 18, 2012 at 5:09 AM, Gunnar Morling
<gunnar.morling at googlemail.com> wrote:
> 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
> buildValidatorFactory().
>
> After having a look at the spec and the API documentation I think it's
> currently unspecified. Any thoughts?
>
> Thanks,
>
> --Gunnar
>
> [1] https://forum.hibernate.org/viewtopic.php?f=9&t=1014788
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
More information about the beanvalidation-dev
mailing list