Class ActionAutowiringInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor,- org.springframework.beans.factory.Aware,- org.springframework.context.ApplicationContextAware
 
 <!-- TODO: Describe how the Interceptor reference will effect execution -->
 <action name="someAction" class="com.examples.SomeAction">
      TODO: fill in the interceptor reference.
     <interceptor-ref name=""/>
     <result name="success">good_result.ftl</result>
 </action>
 
 
 
 Autowires action classes to Spring beans.  The strategy for autowiring the beans can be configured
 by setting the parameter on the interceptor.  Actions that need access to the ActionContext
 can implements the ApplicationContextAware interface.  The context will also be placed on
 the action context under the APPLICATION_CONTEXT attribute.
 
- Author:
- Simon Stewart, Eric Hauser
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected org.springframework.context.ApplicationContextintercept(ActionInvocation invocation) Looks for theApplicationContextunder the attribute that the Spring listener sets in the servlet context.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetAutowireStrategy(Integer autowireStrategy) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Constructor Details- 
ActionAutowiringInterceptorpublic ActionAutowiringInterceptor()
 
- 
- 
Method Details- 
setAutowireStrategy- Parameters:
- autowireStrategy- the autowire strategy
 
- 
interceptLooks for the ApplicationContextunder the attribute that the Spring listener sets in the servlet context. The configuration is done the first time here instead of in init() since theActionContextis not available duringInterceptorinitialization.Autowires the action to Spring beans and places the ApplicationContexton theActionContextTODO: Should this check to see if the SpringObjectFactoryhas already been configured instead of instantiating a new one? Or is there a good reason for the interceptor to have it's own factory?- Specified by:
- interceptin interface- Interceptor
- Specified by:
- interceptin class- AbstractInterceptor
- Parameters:
- invocation- the action invocation
- Throws:
- Exception- in case of any errors
 
- 
setApplicationContextpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
- setApplicationContextin interface- org.springframework.context.ApplicationContextAware
- Parameters:
- applicationContext- the application context
- Throws:
- org.springframework.beans.BeansException- in case of errors
 
- 
getApplicationContextprotected org.springframework.context.ApplicationContext getApplicationContext()- Returns:
- the application context
 
 
-