spring - how to inject springbean to a struts intercepter..is it possible -


i having used defined intercepter,from intercepter want make db call through dao layer, how can inject spring bean struts intercepter.is possible inject spring bean struts intercepter can 1 suggest idea on this.

edit

since there no need declare interceptor spring bean, striked unnecessary parts. @aleksandrm testing it.


exactly way actions , (if remember well) exception of declaring in beans.xml because interceptors don't extend actionsupport (that autowired default) .

web.xml

<listener>     <listener-class>         org.springframework.web.context.contextloaderlistener     </listener-class> </listener> 

applicationcontext.xml

<bean id="daoservicebean"     class="org.foo.bar.business.dao.daoservice"/> 

<bean id="myinterceptorbean"     class="org.foo.bar.presentation.interceptors.myinterceptor"/> 

struts.xml

<constant name="struts.objectfactory" value="spring" />  <package ...>     <interceptors> 

        <interceptor name="myinterceptor" class="myinterceptorbean" /> 

        <interceptor name="myinterceptor"                      class="org.foo.bar.presentation.interceptors.myinterceptor"/> 

myinterceptor.java

private daoservice daoservicebean; // autowired spring 

also read:


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -