0
我想我的資源的子文件映射到服務器的index.html和相關圖片的春天引導映像資源。子文件夾
我的資源位於文件夾資源/ A/B/C的內部。 (即資源/ A/B/C/index.html的)
我想這個HTML網頁從我的根路徑(http://localhost:8080/index.html)訪問。
我伸出WebMvcConfigurerAdapter配置的映射。我嘗試了幾條路,但迄今爲止沒有任何工作。
@SpringBootApplication
public class Application extends WebMvcConfigurerAdapter
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
registry.addResourceHandler("/**").addResourceLocations(
"classpath:/resources/a/b/c",
"classpath:/a/b/c",
"/resources/a/b/c",
"https://stackoverflow.com/a/b/c",
"classpath:resources/a/b/c",
"classpath:a/b/c",
"resources/a/b/c",
"a/b/c");
}
}
有人能給我一些指導嗎?
感謝
嘗試添加重定向'@Override public void addViewControllers(ViewControllerRegistry registry){ registry.addRedirectViewController(「index.html」,「/a/b/c/index.html」); super.addViewControllers(registry); }' – azl