struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Awasthi <umeshawas...@gmail.com>
Subject Re: Preferred Way to Inject Dependency in plugin
Date Wed, 05 Dec 2012 07:24:57 GMT
Thanks Lukasz!!!

I believe with Struts 3.x we should have such mechanism where we can use
Internal DI to inject dependency in such way :)

On Wed, Dec 5, 2012 at 12:45 PM, Lukasz Lenart <lukaszlenart@apache.org>wrote:

> 2012/12/4 Umesh Awasthi <umeshawasthi@gmail.com>:
> > 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
> plugin.
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>


-- 
With Regards
Umesh Awasthi
http://www.travellingrants.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message