title: @autowired does not work on struts2 + spring
body: <p>I want to make a web application based on struts2 and spring.  First of all, I tested if @Autowired does work on struts2. But it does not, dataSource is null. I have no idea how I can fix it. Please give me an infomation for it. </p>
  
  <p>HelloWorld.java</p>
  
  <pre><code>package example;
  import java.sql.Connection;
  import org.apache.commons.dbcp.BasicDataSource;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  import com.opensymphony.xwork2.ActionSupport;
  @Component
  public class HelloWorld extends ActionSupport {
      @Autowired
      private BasicDataSource dataSource;
      public String execute() throws Exception {
          Connection con = dataSource.getConnection();
          con.close();
          return SUCCESS;
      }
  }
  </code></pre>
  
  <p>applicationContext.xml</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
      &lt;property name="driverClassName" value="org.h2.Driver"/&gt;
      &lt;property name="url" value="jdbc:h2:mem" /&gt;
      &lt;property name="maxActive" value="10" /&gt;
      &lt;property name="username" value="sa" /&gt;
      &lt;property name="password" value="" /&gt;
  &lt;/bean&gt;
  
  &lt;context:annotation-config /&gt;
  &lt;context:component-scan base-package="example" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;listener&gt;
    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre>
  
  <p>struts.xml</p>
  
  <pre><code>&lt;constant name="struts.enable.DynamicMethodInvocation" value="false" /&gt;
  &lt;constant name="struts.devMode" value="true" /&gt;
  
  &lt;package name="example" namespace="/example" extends="struts-default"&gt;
      &lt;action name="HelloWorld" class="example.test.HelloWorld"&gt;
          &lt;result&gt;/example/HelloWorld.jsp&lt;/result&gt;
      &lt;/action&gt;
  &lt;/package&gt;
  </code></pre>