title: Alternative to static JdbcTemplate in Spring
body: <p>I have implemented Abstract DAO Factory in Spring.</p>
  
  <p>I have two autowired methods as follows:</p>
  
  <pre><code>private DataSource dataSource;
  private JdbcTemplate jdbcTemplate;
  
  @Autowired
  
  public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
  
      this.jdbcTemplate = jdbcTemplate;
  }
  
  
  @Autowired
  
   public void setDataSource(DataSource dataSource) {
      this.dataSource = dataSource;
  }
  </code></pre>
  
  <p>At the beginning the jdbcTemplate and dataSource get right values in them. But when i call constructor of the class using the new keyword , in which the above methods are written, jdbcTemplate and dataSource get set to NULL.</p>
  
  <p>But if i declare them as static then the previous right values are retained.</p>
  
  <p>I wonder if there is any alternative to static in spring if i want to retain the previous values of the above two ? </p>