title: angular2 spring-boot project structure
body: <p>I have a new angular2 project that was built using the standard file structure described in the quickstart.  I am attempting to build an API gateway and have spring-boot host my application, however I haven't been able to configure boot to use the /dist directory in my project where the generated sources are created.  The project structure is as follows:</p>
  
  <pre><code>project  
  |--dist  
  |--node_modules
  |--src  
  |  |--app  
  |  |--assets
  |  |--main  
  |  |  |--java  
  |  |  |--resources
  |  |  |  |--config  
  |  |  |--webapp
  |  |  |  |--WEB-INF  
  </code></pre>
  
  <p>I would like to use the default /dist directory so that I can still use npm/webpack for continuous development on the UI. </p>
  
  <p>I tried configuring the static resources directory like so:</p>
  
  <pre><code> spring.resources.staticLocations: /dist
  </code></pre>
  
  <p>But this doesn't seem to be working.</p>
  
  <p>I created a resource handler to point directly to the dist directory:</p>
  
  <pre><code>@Configuration
  public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
  
    @Override
    public void addResourceHandlers(final ResourceHandlerRegistry registry) {
  
      String currentPath = new File("./").getAbsolutePath();
      currentPath = "file:///" + currentPath;
  
     registry.addResourceHandler("/**").addResourceLocations(currentPath + "/dist/");
    }
  }  
  </code></pre>
  
  <p>This solves part of the problem but now my root URL ('/') no longer maps to index.html.</p>
  
  <p>Is there an easier/better way to configure spring-boot to find the /dist project directory?  Should my project structure change?  I would really like to get all of these pieces working together cleanly.</p>