Subclass of Struts's default RequestProcessor that autowires Struts Actions
with Spring beans defined in ContextLoaderPlugIn's WebApplicationContext
or - in case of general service layer beans - in the root WebApplicationContext.
In the Struts config file, you simply continue to specify the original
Action class. The instance created for that class will automatically get
wired with matching service layer beans, that is, bean property setters
will automatically be called if a service layer bean matches the property.
<action path="/login" type="myapp.MyAction"/>
There are two autowire modes available: "byType" and "byName". The default
is "byType", matching service layer beans with the Action's bean property
argument types. This behavior can be changed through specifying an "autowire"
init-param for the Struts ActionServlet with the value "byName", which will
match service layer bean names with the Action's bean property names.
Dependency checking is turned off by default: If no matching service
layer bean can be found, the setter in question will simply not get invoked.
To enforce matching service layer beans, consider specify the "dependencyCheck"
init-param for the Struts ActionServlet with the value "true".
If you also need the Tiles setup functionality of the original
TilesRequestProcessor, use AutowiringTilesRequestProcessor. As there's just
a single central class to customize in Struts, we have to provide another
subclass here, covering both the Tiles and the Spring delegation aspect.
The default implementation delegates to the DelegatingActionUtils
class as fas as possible, to reuse as much code as possible despite
the need to provide two RequestProcessor subclasses. If you need to
subclass yet another RequestProcessor, take this class as a template,
delegating to DelegatingActionUtils just like it.
author: Juergen Hoeller since: 2.0 See Also: AutowiringTilesRequestProcessor See Also: ContextLoaderPlugIn See Also: DelegatingActionUtils |