org.springframework.web.struts

## Class AutowiringRequestProcessor

- java.lang.Object
- - org.apache.struts.action.RequestProcessor
  - - org.springframework.web.struts.AutowiringRequestProcessor

- Deprecated.
  as of Spring 3.0

      @Deprecated
      public class AutowiringRequestProcessor
      extends org.apache.struts.action.RequestProcessor

  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.

  Since:
    2.0
  Author:
    Juergen Hoeller
  See Also:
    `AutowiringTilesRequestProcessor`, `ContextLoaderPlugIn`, `DelegatingActionUtils`

- - ### Field Summary

    - ### Fields inherited from class org.apache.struts.action.RequestProcessor

      `actions, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, log, moduleConfig, servlet`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AutowiringRequestProcessor()` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `getAutowireMode()` Deprecated. Return the autowire mode to use for wiring Struts Actions.
    `protected boolean` | `getDependencyCheck()` Deprecated. Return whether to apply a dependency check after wiring Struts Actions.
    `protected WebApplicationContext` | `getWebApplicationContext()` Deprecated. Return the current Spring WebApplicationContext.
    `void` | `init(org.apache.struts.action.ActionServlet actionServlet, org.apache.struts.config.ModuleConfig moduleConfig)` Deprecated.
    `protected int` | `initAutowireMode(org.apache.struts.action.ActionServlet actionServlet, org.apache.struts.config.ModuleConfig moduleConfig)` Deprecated. Determine the autowire mode to use for wiring Struts Actions.
    `protected boolean` | `initDependencyCheck(org.apache.struts.action.ActionServlet actionServlet, org.apache.struts.config.ModuleConfig moduleConfig)` Deprecated. Determine whether to apply a dependency check after wiring Struts Actions.
    `protected WebApplicationContext` | `initWebApplicationContext(org.apache.struts.action.ActionServlet actionServlet, org.apache.struts.config.ModuleConfig moduleConfig)` Deprecated. Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, falling back to the root WebApplicationContext.
    `protected org.apache.struts.action.Action` | `processActionCreate(HttpServletRequest request, HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)` Deprecated. Extend the base class method to autowire each created Action instance.

    - ### Methods inherited from class org.apache.struts.action.RequestProcessor

      `destroy, doForward, doInclude, getInternal, getServletContext, internalModuleRelativeForward, internalModuleRelativeInclude, log, log, process, processActionForm, processActionPerform, processCachedMessages, processContent, processException, processForward, processForwardConfig, processInclude, processLocale, processMapping, processMultipart, processNoCache, processPath, processPopulate, processPreprocess, processRoles, processValidate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AutowiringRequestProcessor

          public AutowiringRequestProcessor()

      Deprecated.

  - ### Method Detail

    - #### init

          public void init(org.apache.struts.action.ActionServlet actionServlet,
                  org.apache.struts.config.ModuleConfig moduleConfig)
                    throws ServletException

      Deprecated.
      Overrides:
        `init` in class `org.apache.struts.action.RequestProcessor`
      Throws:
        `ServletException`

    - #### initWebApplicationContext

          protected WebApplicationContext initWebApplicationContext(org.apache.struts.action.ActionServlet actionServlet,
                                                        org.apache.struts.config.ModuleConfig moduleConfig)
                                                             throws IllegalStateException

      Deprecated.
      Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, falling back to the root WebApplicationContext. This context is supposed to contain the service layer beans to wire the Struts Actions with.
      Parameters:
        `actionServlet` - the associated ActionServlet
        `moduleConfig` - the associated ModuleConfig
      Returns:
        the WebApplicationContext
      Throws:
        `IllegalStateException` - if no WebApplicationContext could be found
      See Also:
        `DelegatingActionUtils.findRequiredWebApplicationContext(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig)`, `ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX`

    - #### initAutowireMode

          protected int initAutowireMode(org.apache.struts.action.ActionServlet actionServlet,
                             org.apache.struts.config.ModuleConfig moduleConfig)

      Deprecated.
      Determine the autowire mode to use for wiring Struts Actions.

      The default implementation checks the "autowire" init-param of the Struts ActionServlet, falling back to "AUTOWIRE_BY_TYPE" as default.

      Parameters:
        `actionServlet` - the associated ActionServlet
        `moduleConfig` - the associated ModuleConfig
      Returns:
        the autowire mode to use
      See Also:
        `DelegatingActionUtils.getAutowireMode(org.apache.struts.action.ActionServlet)`, `AutowireCapableBeanFactory.autowireBeanProperties(java.lang.Object, int, boolean)`, `AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE`, `AutowireCapableBeanFactory.AUTOWIRE_BY_NAME`

    - #### initDependencyCheck

          protected boolean initDependencyCheck(org.apache.struts.action.ActionServlet actionServlet,
                                    org.apache.struts.config.ModuleConfig moduleConfig)

      Deprecated.
      Determine whether to apply a dependency check after wiring Struts Actions.

      The default implementation checks the "dependencyCheck" init-param of the Struts ActionServlet, falling back to no dependency check as default.

      Parameters:
        `actionServlet` - the associated ActionServlet
        `moduleConfig` - the associated ModuleConfig
      Returns:
        whether to enforce a dependency check or not
      See Also:
        `DelegatingActionUtils.getDependencyCheck(org.apache.struts.action.ActionServlet)`, `AutowireCapableBeanFactory.autowireBeanProperties(java.lang.Object, int, boolean)`

    - #### getWebApplicationContext

          protected final WebApplicationContext getWebApplicationContext()

      Deprecated.
      Return the current Spring WebApplicationContext.

    - #### getAutowireMode

          protected final int getAutowireMode()

      Deprecated.
      Return the autowire mode to use for wiring Struts Actions.

    - #### getDependencyCheck

          protected final boolean getDependencyCheck()

      Deprecated.
      Return whether to apply a dependency check after wiring Struts Actions.

    - #### processActionCreate

          protected org.apache.struts.action.Action processActionCreate(HttpServletRequest request,
                                                            HttpServletResponse response,
                                                            org.apache.struts.action.ActionMapping mapping)
                                                                 throws IOException

      Deprecated.
      Extend the base class method to autowire each created Action instance.
      Overrides:
        `processActionCreate` in class `org.apache.struts.action.RequestProcessor`
      Throws:
        `IOException`
      See Also:
        `AutowireCapableBeanFactory.autowireBeanProperties(java.lang.Object, int, boolean)`