I'm new to Java and to Spring.
How can I map my app root http://localhost:8080/
to a static index.html
?
If I navigate to http://localhost:8080/index.html
its works fine.
My app structure is :
My configWebConfig.java
looks like this:
@Configuration
@EnableWebMvc
@ComponentScan
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("/");
}
}
I tried to add registry.addResourceHandler("/").addResourceLocations("/index.html");
but it fails.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…