title: Autowired object is getting null
body: <p>I am using Spring Boot for my application. I am defining JNDI name in the <code>application.properties</code> file.</p>
  
  <p>When I am trying to get <code>JdbcTemplate</code> in below class, its <code>null</code>:</p>
  
  <pre><code>@Configuration
  public class DemoClass
  {
      @Autowired
      private JdbcTemplate template;
  
      @Bean
      private DataSource getDS(){
          return template.getDataSource(); //NPE
      }
  }
  </code></pre>
  
  <p>Another Class</p>
  
  <pre><code>@Component
  public class SecondClass {
      @Autowired
      private JdbcTemplate template;
  
      public void show(){
          template.getDataSource(): // Working Fine
      }
  }
  </code></pre>