Spring boot sprinb boot+cloud zuul和swagger api文档无法生成正确的json
我正在使用SpringCloudZuul和swagger,我想在api文档中添加基于下面这个类的整个配置。当我使用swagger-ui.html时,所有内容都正确显示,但当我想使用v2/api文档时,我找不到任何端点。 这是我的配置类:Spring boot sprinb boot+cloud zuul和swagger api文档无法生成正确的json,spring-boot,swagger,spring-cloud,swagger-2.0,netflix-zuul,Spring Boot,Swagger,Spring Cloud,Swagger 2.0,Netflix Zuul,我正在使用SpringCloudZuul和swagger,我想在api文档中添加基于下面这个类的整个配置。当我使用swagger-ui.html时,所有内容都正确显示,但当我想使用v2/api文档时,我找不到任何端点。 这是我的配置类: @Primary @Configuration public class SwaggerConfig implements SwaggerResourcesProvider { @Override public List<SwaggerRe
@Primary
@Configuration
public class SwaggerConfig implements SwaggerResourcesProvider {
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> swaggerResources = new ArrayList<>();
swaggerResources.add(swaggerResource("USER-SERVICE", "/api/user/v2/api-docs"));
swaggerResources.add(swaggerResource("MOVIE-SERVICE", "/api/movie/v2/api-docs"));
return swaggerResources;
}
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build();
}
private SwaggerResource swaggerResource(String name, String location) {
SwaggerResource swaggerResource = new SwaggerResource();
swaggerResource.setName(name);
swaggerResource.setLocation(location);
swaggerResource.setSwaggerVersion("2.0");
return swaggerResource;
}
}
如果有人知道为什么我在swagger-ui.html中正确地看到了所有内容,但在v2/api文档中没有,请告诉我