我使用Springfox Swagger2和Spring boot 1.5.9 .
我可以在此链接上访问swagger UI .
http://localhost:8090/swagger-ui.html
如何将其更改为可在以下URL上使用?
http://localhost:8090/my/custom/path/swagger-ui.html
@EnableSwagger2
public class Configuration {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("my.favorite.package"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo()).useDefaultResponseMessages(false);
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("My title").version("1.0")
.contact(new Contact("Blah", "blah.com", "blah@blah.com")).build();
}
}
1 回答
试试这个配置类 .