I am in a project having frameworks like Spring 3 + Struts 2 + Hibernate 3. Also it uses spring security.
Spring and Struts is integrated using spring ContextLoaderListener
defined in web.xml
<listener>
<display-name>Spring Initialization</display-name>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
There are several service classes which usually make db calls. like agentserviceprocess
is one such class having method like getAgents()
.
Struts actions have a property and setter getter for each process and those process classes are defined as bean in application-context.xml
.
Surprisingly I can not find any bean having action class as class parameter. I mean spring is not controlling the action object instantiation. Then how spring can inject service property objects inside these actions?
Also,
I found following entry
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>*.action</url-pattern>
<url-pattern>*.htm</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…