To make @Autowired
work in your struts application you need to the given things:
Make sure you have the struts2 and spring plugin in your classpath.
Put the following line in strtus.xml
<struts>
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
...
</struts>
Configure the Action classes
in xml file of spring
<bean id="editAction" class="org.apache.struts.edit.action.EditAction" >
<property name="editService" ref="editService" />
</bean>
And give the bean id in struts.xml
file instead of giving the action class
<action name="edit" class="editAction" method="input">
<result name="input">/edit.jsp</result>
</action>
For more information consult http://struts.apache.org/release/2.2.x/docs/spring-and-struts-2.html and http://struts.apache.org/release/2.2.x/docs/spring-plugin.html