title: How to read properties files inside WEB-INF?
body: <p>I'm trying to read a configuration files which I put under /WEB-INF/config folder. The reason is that the Jetty Maven plugin <a href="https://stackoverflow.com/questions/7475811/how-to-filter-resources-when-using-maven-jetty-plugin">does not support resource filtering</a>. Can some one please explain me how to do that using Spring Java configuration feature ?</p>
  
  <p>I know that <code>&lt;context: property-placeholder ... /&gt;</code> should work, but i dont want to use XML.</p>
  
  <p><strong>application dirs</strong></p>
  
  <pre><code>├───META-INF
  └───WEB-INF
      ├───classes
      ├───config
      ├───i18n
      ├───lib
      ├───pages
      └───resources
  </code></pre>
  
  <p><strong>property sources configuration</strong></p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @PropertySources({
      @PropertySource("log4j.properties"),
      @PropertySource("general.properties") }
  )
  public class ApplicationContext extends WebMvcConfigurerAdapter {
  
      @Autowired
      ServletContext servletContext;
  
      @Bean
      public PropertyPlaceholderConfigurer properties() {
          PropertyPlaceholderConfigurer propertySources = new PropertyPlaceholderConfigurer();
          Resource[] resources = new ServletContextResource[] {
                          new ServletContextResource(servletContext, "WEB-INF/config/log4j.properties"),
                          new ServletContextResource(servletContext, "WEB-INF/config/general.properties")
          };
          propertySources.setLocations(resources);
          propertySources.setIgnoreUnresolvablePlaceholders(true);
          return propertySources;
      }
  }
  </code></pre>
  
  <p><strong>exception:</strong></p>
  
  <pre><code>java.lang.IllegalArgumentException: Cannot resolve ServletContextResource without ServletContext
  </code></pre>