title: Spring Java based configuration with static method
body: <p>can any one please advice why we need to declare PropertySourcesPlaceholderConfigurer bean using a <strong>static</strong> method ? I just found that if I use non-static for below then url will be set to null value instead of taking from property file - </p>
  
  <pre><code>@Value("${spring.datasource.url}")
  private String url;
  
  @Bean
  public static PropertySourcesPlaceholderConfigurer propertyConfig(String profile) {
      String propertyFileName = "application_"+profile+".properties";
      System.out.println(propertyFileName);
      PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
      configurer.setLocation(new ClassPathResource(propertyFileName));
      return configurer;
  }   
  
  @Bean
  @Profile("local")
  public static String localProfile(){
      return "local";
  }
  
  @Bean
  @Profile("prod")
  public static String prodProfile(){
      return "prod";
  }
  </code></pre>