title: JdbcTemplate not working with autowiring
body: <p>I am creating a REST application using Springboot. After doing some research I added JdbcTemplate to it rather than working directly with Jdbc and resultsets. I have the following configuration in <code>application.properties</code>. </p>
  
  <pre><code>server.context-path=/foo
  spring.datasource.driverClassName=com.teradata.jdbc.TeraDriver
  spring.datasource.url=jdbc:teradata://url
  spring.datasource.username=root
  spring.datasource.password=root
  </code></pre>
  
  <p>My REST controller has the following code</p>
  
  <pre><code>@RestController
  public class LosController {
  
      @CrossOrigin
      @RequestMapping("/bar")
      public String Bar(){
          Gson gson = new Gson();
          Bar bar = new Bar();
          response = gson.toJson(bar.getData());
          return response;
      }
  </code></pre>
  
  <p>and in this object, I have</p>
  
  <pre><code>public class Bar {
  
      @Autowired
      private JdbcTemplate jdbcTemplate;
  
      public List&lt;BarObject&gt; getData(){
          String selectSql = "SELECT * FROM BAR";
          System.out.println(selectSql);
          System.out.println(jdbcTemplate.getDataSource().toString());
  
          List&lt;BarObject&gt; barObjs = jdbcTemplate.query(selectSql, new BarMapper());       
  
          return barObjs;
      }
  }
  </code></pre>
  
  <p>I went through this <a href="https://stackoverflow.com/questions/27697190/spring-boot-autoconfiguration-with-jdbc-template-autowiring-datasource-issue">link</a> and configured everything as mentioned. I am able to see the <code>System.out.println(selectSql</code>) working. But at the next line, I am getting a <code>null pointer exception</code>. So the JdbcTemplate object isn't getting the data is what I feel. How can I get this working? I am trying to not use any xml configurations, which is the reason why I went for a properties file.</p>