title: Springboot - DevTools - RestController not always mapped when Rebuild Project
body: <p>I'm using SpringBoot 1.3.5 with maven.</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.3.5.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  </code></pre>
  
  <p>And devtools</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I'm using Intellij IDEA 2016.2, previously 2014 with same problem.</p>
  
  <p>I'm running my springboot app from Intellij Idea, first launch everything is well loaded and works, I can access my static pages and my 2 Rest Controllers work.</p>
  
  <pre><code>2016-08-18 15:27:58.771  INFO 26626 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@469d0c02: startup date [Thu Aug 18 15:27:57 CEST 2016]; root of context hierarchy
  2016-08-18 15:27:58.789  INFO 26626 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authentication/introspect],methods=[GET]}" onto public com.myapp.models.TokenIntrospection com.myapp.resources.AuthenticationResources.introspectToken(java.lang.String)
  2016-08-18 15:27:58.790  INFO 26626 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/configuration],methods=[GET]}" onto public com.myapp.models.AppConfiguration com.myapp.resources.ConfigurationResources.getConfiguration()
  2016-08-18 15:27:58.792  INFO 26626 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity&lt;java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt; org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
  2016-08-18 15:27:58.793  INFO 26626 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
  </code></pre>
  
  <p>Because simply "Make Project" doesn't work well for static reload, I use "Rebuild Project" and sometimes, when app restart, I don't have my controllers mapped, sometimes one is missing, sometimes both are missing.</p>
  
  <p>I don't have any clue about this :(</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>@Morfic solutions did not work, so I used the Intellij local server to serve static contents and gulp-livereload instead of spring-dev-tools.</p>
  
  <p><a href="https://i.stack.imgur.com/qwYztm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qwYztm.png" alt="IJ local server"></a></p>
  
  <p>I just had to manage REST calls in JS when I'm in dev mode because REST resources are on localhost:8080 but my statics on localhost:63342, and enable CORS in my springboot (with a flag in properties file to enable CORS or not).</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class CorsConfig extends WebMvcConfigurerAdapter {
  
      @Value("${cors.enabled}")
      private boolean corsEnabled;
  
      @Override
      public void addCorsMappings(CorsRegistry registry) {
          super.addCorsMappings(registry);
          if(corsEnabled) {
              registry.addMapping("/**")
                      .allowedOrigins("*")
                      .allowedMethods("GET", "PUT", "POST", "DELETE", "OPTIONS")
                      .allowedHeaders("Origin", "X-Requested-With", "Content-Type", "Accept", "Authorization")
                      .allowCredentials(true)
                      .maxAge(3600L);
          }
      }
  }
  </code></pre>
  
  <p>So question still pending for a working solution.</p>