MVCで闊歩を統合し、闊歩し、Spring MVCの統合
@Configuration
@EnableSwagger2
@PropertySource("classpath:application.properties")
public class SwaggerConfig extends WebMvcConfigurerAdapter {
.
.
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
のようなJavaベースの構成を使用して、URL http://localhost:8080/admin-api/admin/swagger-ui.html
を使用する場合、それは私がSwaggerConfig
コンフィギュレーションクラスからaddResourceHandlers
を削除すると404に を与え、XMLを通じて設定などの
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/" />
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/" />
と同じURL http://localhost:8080/admin-api/admin/swagger-ui.html
これは問題なく動作します。どのように私はJavaベースの設定を使用することができますか?闊歩で
スワーザーの@APIを与えることができる –