title: Spring Boot not reading from property file
body: <p>I have tried every option on web but not able to set the values in following method:</p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:application.properties")
  public class MyDataSource {
      @Value("${db.driver}") 
      private String DB_DRIVER;
  
      @Value("${db.url}")
      private String DB_URL;
  
      @Value("${db.username}")
      private String DB_USERNAME;
  
      @Value("${db.password}")
      private String DB_PASSWORD;
  
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
          return new PropertySourcesPlaceholderConfigurer();
      }
  
      @Bean
      public DataSource getDataSource() {
           DriverManagerDataSource dataSource = new DriverManagerDataSource();
           dataSource.setDriverClassName(DB_DRIVER);
           dataSource.setUrl(DB_URL);
           dataSource.setUsername(DB_USERNAME);
           dataSource.setPassword(DB_PASSWORD);
  
           return dataSource;
       }
  }
  </code></pre>
  
  <p>My <code>application.properties</code> is in <code>main/resources</code> folder and values can be seen in variables in debug mode. But on running app, it shows <code>Property ' ' must not be empty.</code></p>
  
  <p>EDIT:  I am not sure what can be the issue in first case?
  So changed the application.property file as suggested and code as below :</p>
  
  <pre><code>@Autowired
  protected JdbcTemplate jdbcTemp;
  
  public List&lt;&gt; getData(String id) {
  
      return jdbcTemp.query("SELECT ........,new RowMapper());
  }
  </code></pre>
  
  <p>But getting java.lang.NullPointerException:</p>