title: Spring 3.0 injection null after initalization
body: <p>I am trying to inject the datasource object into a servlet. I have the logger to print in the set method. It works ok on pre-inialization. But when I request the servlet it gives me nullPointerException.</p>
  
  <p>Any suggestion on why this happen? (I don't think this related to the servlet I am extending)</p>
  
  <p>Here is the applicationContext.xml </p>
  
  <pre><code>&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
      &lt;property name="url" value="${jdbc.url}"/&gt;
      &lt;property name="username" value="${jdbc.username}"/&gt;
      &lt;property name="password" value="${jdbc.password}"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="dataServlet" class="com.mycom.util.DataServlet"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="test" value="dataSource" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The servlet</p>
  
  <pre><code>public class DataServlet extends DataSourceServlet {
  ...
  @Autowired
      public void setDataSource(DataSource dataSource) {
          this.jdbcTemplate = new JdbcTemplate(dataSource);
          logger.log(Level.INFO, "Inj: datasrc");
      }
  @Autowired
      public void setTest(String test) {
          this.test = test;
          logger.log(Level.INFO, "Set Test {0}", this.test);
      }
  }
  </code></pre>
  
  <p>I set break point @ the setTest, it breaks @ pre-init. but when the actual object being request. It is doesn't break @ the setTest.</p>
  
  <p>Why is it so? (singleton/ scope issue related?)</p>
  
  <p>Please advise!
  Thanks in advance!</p>