title: spring boot web application does not serve static content
body: <p>I am working on a spring boot application using angular framework. I have structured the project as following :</p>
  
  <ul>
  <li>src/main/java  : spring-boot files, controllers, persistence</li>
  <li>src/main/resources  :    application.properties</li>
  <li>src/main/app  : "webapp" files, angular, css, modules</li>
  </ul>
  
  <p>In order to have spring serve static content under /app I've extended the class WebMvcConfigurerAdapter by overriding addResourceHandlers method :</p>
  
  <pre><code>@EnableWebMvc
  @Configuration
  @ComponentScan(basePackages = { "com.myapp.controller" })
  public class WebMvcConfig extends WebMvcConfigurerAdapter {
  
  private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/",
          "classpath:/resources/", "/" }; //src/main/webapp works by default
  
  private static final String[] RESOURCE_LOCATIONS = { "classpath:/src/main/app/", "classpath:/src/main/app/" };
  
  @Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {
  
      if (!registry.hasMappingForPattern("/webjars/**")) {
          registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
      }
  
      if (!registry.hasMappingForPattern("/**")) {
          registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS).setCachePeriod(0);
      }
  
      if (!registry.hasMappingForPattern("/app/**")) {
          registry.addResourceHandler("/app/**").addResourceLocations(RESOURCE_LOCATIONS).setCachePeriod(0);
      }
  }}
  </code></pre>
  
  <p>When trying to access angular main file using 
  <code>http://localhost:8080/app/app.html</code>
  I get an http error 404. For some reason if I rename /app folder into /webapp I am able to target <code>http://localhost:8080/app.html</code> . I'm definitely missing out something but can't figure out what it is . Thanks</p>