You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <ne...@yahoo.com> on 2009/04/27 19:12:34 UTC
Re: Autowired and PostConstruct with Struts + Spring
e_slippy@yahoo.it wrote:
> Hello everybody!
>
> I'm trying to use my service into a Struts action but with no success.
>
> My struts action contains :
>
> @Autowired
> private MyService myService
>
> @PostConstruct
> public void init() {
> // use here myService
> }
>
> Unfortunately myService is always null and I cannot use myService in the init() method...
>
> The bean myService should correctly declared in my application-context.xml:
> <bean id="myService" class="com.mypackage.MyServiceImpl">
> <property name="..." ref="..." />
> ...
> </bean>
>
> and my struts.xml contains:
> <constant name="struts.objectFactory" value="spring" />
>
> Where I'm wrong?
Is there a public myService setter?
(I hardly even use annotations; maybe that's not necessary?)
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org