struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <>
Subject Re: Preferred Way to Inject Dependency in plugin
Date Wed, 05 Dec 2012 07:15:22 GMT
2012/12/4 Umesh Awasthi <>:
> Thanks for the inputs
> I have this BeanValidationManagerProvider interface with a method  public
> Validator getValidator() which will return Validator based on the actual
> provider.
> Any Bean Validator in reference to JSR303 will implement
> javax.validation.Validator
> So in my BeanValidationManagerProvider Impl class i was thinking to
> providing a way to let  user inject actual provider with this setter method
>  protected Class providerClass;
>  public void setProviderClass( Class<? extends ValidationProvider>
> providerClass)
>     {
>         this.providerClass = providerClass;
>     }
> and than i will be able to get Validator by a simple call
> Validation.byProvider(this.providerClass).configure().buildValidatorFactory();
> May be i am wrong in my process, but i was wondering how best we can let
> user decide which provider they want to inject

I thought there should be a common way to load ValidationProvider,
like you just check Class.forName("javax....ValidationProvider") and
then throws exception that the user must add missing dependency. In
Maven you can define given implementation as an optional and user will
have to define a concrete implementation when he will try to use the

+ 48 606 323 122

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message