ฉันเพิ่งเริ่มใช้ Java และ Spring ฉันจะแมปรูทแอปของฉันhttp://localhost:8080/กับแบบคงที่ได้index.htmlอย่างไร ถ้าฉันไปที่http://localhost:8080/index.htmlมันใช้งานได้ดี
โครงสร้างแอปของฉันคือ:

ของฉันconfig\WebConfig.javaมีลักษณะดังนี้:
@Configuration
@EnableWebMvc
@ComponentScan
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("/");
}
}
ฉันพยายามเพิ่มregistry.addResourceHandler("/").addResourceLocations("/index.html");แต่มันล้มเหลว
http://localhost:8080/appNameแต่มันไม่ใช่สิ่งที่ฉันต้องการ ...
