2013/9/24 Savage, Patrick <patrick.sav...@3pillarglobal.com>:
>> How do you declare bean in struts.xml? As this is strange, if all injections
>> are skipped, it must be something else.
>
> We don't actually declare the bean in struts.xml at all. Is that required in
> order for @Inject to inject Struts objects into my bean? This has worked
> without declaring the bean since we upgraded to Struts 2.1.8 in 2010. Should
> I add this to struts.xml?:
>   <bean class="com.candyland.web.converters.CandylandCollectionConverter"/>
>
> Should I also add a bean for our custom validator manager that uses @Inject?
> We currently have this in struts.xml but no <bean>:
>   <constant name="struts.actionValidatorManager"
>             value="com.candyland.web.ReportTemplateValidationManager"/>

You know, Container is a black magic for us and that's why we want to
switch to Guice ;-)

Anyway, I think yes, you should declare your custom converter as a
bean - Container doesn't perform scan of classpath to discover @Inject
annotation. Probably it is a side effect of scanning methods -
Container will create injectors for each method annotated with @Inject
and your convert must be used in some already defined bean - that's
why it use to work.

Regarding 'struts.actionValidatorManager' it should be reference to
bean not to a class, so you should declare a bean with name and then
use that name in 'struts.actionValidatorManager'

<bean name="ccConverter"
class="com.candyland.web.converters.CandylandCollectionConverter"/>
<constant name="struts.actionValidatorManager" value="ccConverter"/>


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to