[bv-dev] BVAL-238 Dependency injection in ConstraintViolation

Emmanuel Bernard emmanuel at hibernate.org
Wed Jan 4 09:05:34 EST 2012


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.


More information about the beanvalidation-dev mailing list