title: Java Spring Boot: How to map my app root (“/”) to index.html?
body: <p>I'm new to Java and to Spring.
  How can I map my app root <code>http://localhost:8080/</code> to a static <code>index.html</code>?
  If I navigate to <code>http://localhost:8080/index.html</code> its works fine.</p>
  
  <p>My app structure is :</p>
  
  <p><img src="https://i.stack.imgur.com/bMEaw.png" alt="dirs"></p>
  
  <p>My <code>config\WebConfig.java</code> looks like this:</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan
  public class WebConfig extends WebMvcConfigurerAdapter {
  
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/**").addResourceLocations("/");
          }
  }
  </code></pre>
  
  <p>I tried to add <code>registry.addResourceHandler("/").addResourceLocations("/index.html");</code> but it fails.</p>