[bv-dev] bv-dev] [BVAL-251] Improve Bean Validation support for modularized environments

Hardy Ferentschik hardy at hibernate.org
Fri May 4 06:11:30 EDT 2012


Hi,

Seems everyone is tired of OSGi? Maybe adding the OSGi header is as far as we should go.

However, I would like to use this thread to a related question - class loading. 
At several occasions Hibernate Validator needs to do some class loading or at least needs a class loader
(e.g. loading classes specified in the  xml configuration, detecting whether JPA is on the classpath in the case 
of TraversableResolver,  loading resource bundles).

The spec does not define which class loader should be used in these cases. Hibernate Validator for example
first tries the context and then the current class loader. The question is whether there is a need to specify which
class loader should be used or should there even be a ClassLoaderService:

public interface ClassLoaderService {
	public <T> Class<T> classForName(String className);

        // potentially more class loader related methods
       ….
}

An implementation of such a service could be passed if we add javax.validation.Configuration#classLoaderService(ClassLoaderService).

WDYT?

--Hardy


On Apr 24, 2012, at 10:07 AM, Emmanuel Bernard wrote:

> 
> On 13 avr. 2012, at 13:37, Hardy Ferentschik wrote:
> 
>> Emmanuel, you mentioned that we might align CDI in regards to OSGi. Are there any news there?
> 
> Not that I know of.




More information about the beanvalidation-dev mailing list