私は静的コンテンツ(HTML、CSS、JavaScriptファイル)で次のフォルダを持っている:春ブーツMavenのWebアプリケーションフォルダとResourceHandler
/src/main/webapp/docs/
これは私のアプリケーションのプロパティです:
server.port: 8080
server.contextPath: /admin-api
ユーザーが次のURLにアクセスしたとき:http://localhost:8080/admin-api/docs
私は彼に/src/main/webapp/docs/
フォルダの静的コンテンツを表示します。
は、私は私のWebMvcConfigurerAdapter
でResourceHandler
を設定しようとしているが、それは動作しません:
@EnableWebMvc
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
String[] staticResourceMappingPath = { "/docs/", "classpath:/docs/" };
registry.addResourceHandler("/docs").addResourceLocations(staticResourceMappingPath);
}
...
}
http://localhost:8080/admin-api/docs
リターン404が見つかりません。
私は間違って何を正しく設定するのですか?