Avoid @EnableWebMvc
By default, Spring-Boot executes static content in src/main/resources :
- / META-INF / resources /
- /resources/
- /static/
- /state/
Look this one and this one ;
Or save @EnableWebMvc and override addViewControllers
Did you specify @EnableWebMvc ? Take a look at this: Java Spring Download: how to map application root ("/") to index.html?
Either you delete @EnableWebMvc, or you can override addViewControllers :
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("forward:/index.html"); }
Or define a controller to catch /
You can see this spring-boot-reactjs sample project on github :
It does what you want using the controller:
@Controller public class HomeController { @RequestMapping(value = "/") public String index() { return "index"; } }
Its index.html is under src/main/resources/templates
source share