【发布时间】:2019-04-26 01:14:48
【问题描述】:
我在 Spring boot(版本 1.5.9.RELEASE)项目中使用 swagger 2.0。 Swagger 工作正常,但现在文档有数百个 api,我想在不同的不同 url 上重定向文档。我有像 blow 这样的 swagger 配置。
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket postsApi() {
return new Docket(DocumentationType.SWAGGER_2).groupName("public-api")
.apiInfo(apiInfo()).select().paths(postPaths()).build();
}
private Predicate<String> postPaths() {
return or(regex("/api/posts.*"), or(regex("/api/.*"), regex("/secure/api/.*")));
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Swagger API")
.description("Swagger Integration with Spring Boot")
.termsOfServiceUrl(null)
.license(null)
.licenseUrl(null).version("1.0").build();
}
}
请提出任何建议。提前致谢。
【问题讨论】:
标签: spring spring-boot swagger swagger-2.0