[prev in list] [next in list] [prev in thread] [next in thread]
List: struts-user
Subject: Re: Using multiple @Inject in constructor giving run time error
From: Umesh Awasthi <umeshawasthi () gmail ! com>
Date: 2013-10-16 7:39:39
Message-ID: CAAJB1JPG=K+rQN3jSGshF+wfvkFrgBQQrdKJeq1L7LyQb4TL0Q () mail ! gmail ! com
[Download RAW message or body]
Thanks!!
I am wondering why it is working fine for other case?
I was expecting that Struts2 will convert it for me ;)
Thanks
Umesh
On Wed, Oct 16, 2013 at 12:54 PM, Lukasz Lenart <lukaszlenart@apache.org>wrote:
> 2013/10/16 Umesh Awasthi <umeshawasthi@gmail.com>:
> > I am trying to inject few values to my bean like
> >
> > @Inject
> > public
> >
> DefaultJSR303ValidationManager(@Inject(value=ValidatorConstants.PROVIDER_CLASS,required=false)
> > String providerClassName,
> >
> > @Inject(value=ValidatorConstants.IGNORE_XMLCONFIGURAITION,required=false)
> > boolean ignoreXMLConfiguration
> > )
> > {
> > // some code
> > }
> >
> >
> > Entries from struts-plugin.xml
> >
> > <constant name="providerClass" value=""/>
> > <constant name="ignoreXMLConfiguration" value="false"/>
> >
> > but i am getting following exception
> >
> > Caused by:
> > com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException:
> No
> > mapping found for dependency [type=boolean,
> name='ignoreXMLConfiguration']
> >
> > how ever if i change it to
> > @Inject
> > public
> >
> DefaultJSR303ValidationManager(@Inject(value=ValidatorConstants.PROVIDER_CLASS,required=false)
> > String providerClassName
> > )
> > {
> > }
> >
> > @Inject(value=ValidatorConstants.IGNORE_XMLCONFIGURAITION,required=false)
> > public void setIgnoreXMLConfiguration( boolean
> ignoreXMLConfiguration )
> > {
> > this.ignoreXMLConfiguration = ignoreXMLConfiguration;
> > }
> >
> > everything is working fine and dependencies are being injected correctly.
> > I am not sure if where i am doing wrong ?
> > can't i have multiple @inject inside constructor?
>
> <constant/> defines String not boolean, try something like this:
>
> @Inject
> public
> DefaultJSR303ValidationManager(@Inject(value=ValidatorConstants.PROVIDER_CLASS,required=false)
> String providerClassName,
>
> @Inject(value=ValidatorConstants.IGNORE_XMLCONFIGURAITION,required=false)
> String ignoreXMLConfiguration) {
>
> this. ignoreXMLConfiguration =
> "true".equalsIgnoreCase(ignoreXMLConfiguration);
>
> }
>
>
> Regards
> --
> Ćukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
With Regards
Umesh Awasthi
http://www.travellingrants.com/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic