title: @Autowired on a field and on a setter method
body: <p>I've had a weird situation while autowiring properties of my bean. @Autowired put on setter method doesn't work properly and field that corresponds to that setter returns me <code>NullPointerException</code> when I try to get access to some of it's methods. On the other hand, @Autowired put on field directly works fine.</p>
  
  <p>What could be the reason of such a behavior and what is the difference between putting @Autowired on the field and field's corresponding setter?</p>
  
  <p>Here is excerpt from my code:</p>
  
  <pre><code>private JdbcOperations jdbcTemplate;
  
  protected JdbcOperations getJdbcTemplate() {
      return jdbcTemplate;
  }
  
  @Autowired
  @Qualifier("jdbcTemplate")
  public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
      this.jdbcTemplate = jdbcTemplate;
  }
  </code></pre>
  
  <p>Here is from context:</p>
  
  <pre><code>&lt;bean name="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
      &lt;constructor-arg ref="routingDataSource"/&gt; 
  &lt;/bean&gt;
  </code></pre>
  
  <p>Thank you very much for explanations!</p>