I know that in spring I must define welcome-file, which should be outside of WEB-INF folder, so I define it like this:
web.xml:
In case of java configuration you can override two methods in class that extends WebMvcConfigurerAdapter
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("/index");
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
If you wanna serve index.html explicitly, turn it into a resource override a method in the same class as below:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/index.html").addResourceLocations("/WEB-INF/views/index.html");
}
Of course addResourceLocations must follows the folder choosen to hold your views.
See these samples