[bv-dev] BVAL-238 Dependency injection in ConstraintViolation
Emmanuel Bernard
emmanuel at hibernate.org
Wed Jan 4 09:31:33 EST 2012
Every DI can provide you with an instance :) In CDI basically any Java class is a CDI bean and thus can be provided :)
On 4 janv. 2012, at 15:22, Gerhard Petracek wrote:
> as mentioned before, we don't need a config to choose the right one. the right one is the one which provides an instance.
>
> regards,
> gerhard
>
>
>
> 2012/1/4 Emmanuel Bernard <emmanuel at hibernate.org>
>
> On 4 janv. 2012, at 14:54, Hardy Ferentschik wrote:
>
> >
> > On Jan 4, 2012, at 2:31 PM, Gerhard Petracek wrote:
> >
> >> +1 -> compared to the other suggestions: +1 for the service-loader approach because it allows jsr330 support without the need to add a new method to ValidatorContext as well as a new config entry and it's a std. java mechanism.
> >
> > Can we flesh this out a little. What would be the service interface?
>
> I imagine something similar to the `InstanceProvider` I've proposed.
>
> But I don't think I agree that a ServiceLoader + a new config to chose the right one is better than a new config pointing to the class + an API to provide the instance in the bootstrap. At least that's not consistent with our treatment of `TraversableResolver`, `MessageInterpolator` and `ConstraintValidatorFactory`. And we know that service loader files (META-INF/services/*) don't play well in modular environments esp OSGi.
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20120104/ed7c16fe/attachment.html
More information about the beanvalidation-dev
mailing list