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

Emmanuel Bernard emmanuel at hibernate.org
Mon May 14 04:01:07 EDT 2012


I'm not sure if that should be as classForName or by passing the classloader but I see the following needs:

What: 

- load a resource (XML)
- load a class and package
- all validation provides available - see provider resolver

>From where:

- from the user application or from the module depending on BV
- from a dependency of the application or module depending on BV

The second case is interesting, we need to know for example:

- if JPA is a dependency of the application
- find constraints and constraint validators contained in either the application directly or in a dependency of the application

I am not sure how to do that in various modular environments. I also wonder if all of this should be masked behind a contract like your describe, or if the list of classloaders should be exposed to BV and processed. I am also not sure of the impact of object lifecycle.

Emmanuel 


On 4 mai 2012, at 12:11, Hardy Ferentschik wrote:

> 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.
> 
> 
> _______________________________________________
> 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