非スプリングブートアプリでswagger uiを構成しようとしています。私は次のことをしました。1.以下の依存関係を追加
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.5</version>
</dependency>
2. Swagger Config クラスを追加
@Configuration
@EnableSwagger2
@EnableWebMvc
//@PropertySource("classpath:/swagger.properties")
public class SwaggerConfig {
@Bean
public Docket proposalApis(){
return new Docket(DocumentationType.SWAGGER_2)
.groupName("test")
.select()
.apis(RequestHandlerSelectors.basePackage("com.test.abc"))
.paths(PathSelectors.regex("/test1.*"))
.build()
.apiInfo(testApiInfo());
}
private ApiInfo testApiInfo() {
ApiInfo apiInfo = new ApiInfoBuilder().title("Test APIs").description("GET POST PUT methods are supported ").version("V1").build();
return apiInfo;
}
}
次のマッピングを追加しました:
<mvc:resources mapping="swagger-ui.html" location="classpath:/META- INF/resources/"/> <mvc:resources mapping="/webjars/**" location="classpath:/META- INF/resources/webjars/"/>
次のURLにアクセスできます
/v2/api-docs
/swagger-resources
しかし、swagger-ui.html の読み込み中に UI が読み込まれ、サーバーで次のエラーが発生します
No mapping found for /context/swagger-resources/configuration/ui in Dispatcher servlet
誰か助けてくれませんか?