【发布时间】:2018-11-15 16:10:55
【问题描述】:
我在 Spring boot 1.5.9 中使用 Springfox Swagger2。
我可以通过此链接访问 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();
}
}
【问题讨论】:
标签: java spring-boot swagger swagger-ui swagger-2.0