I\'ve got static
folder with following structure:
index.html
docs/index.html
Spring Boot correctly maps reque
After Java 8 introduced Default Methods in Interfaces, WebMvcConfigurerAdapter
has been deprecated in Spring 5 / Spring Boot 2.
Using it will now raise the warning:
The type WebMvcConfigurerAdapter is deprecated
Hence, to make @hzpz's solution work again, we need to change it as follows:
@Configuration
public class CustomWebMvcConfigurer implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/docs").setViewName("redirect:/docs/");
registry.addViewController("/docs/").setViewName("forward:/docs/index.html");
}
}