2017-03-16 16:09:08.821 INFO 9104 --- [ main] com.hello.EurekaClientApplication : No active profile set, falling back to default profiles: default 2017-03-16 16:09:08.848 INFO 9104 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5dcd8c7a: startup date [Thu Mar 16 16:09:08 CDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@441772e 2017-03-16 16:09:09.873 INFO 9104 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'hystrixFeature' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixWebConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); defined in class path resource …
我有多个微服务,已经为此大刀阔斧了。我想将所有api置于单一的swagger UI下。我已经按照以下链接进行了此操作。但在STS中以Maven方法尝试过。 昂首阔步的Github示例
这是我在项目中的不同文件,
@SpringBootApplication
@ComponentScan
@EnableAutoConfiguration
@EnableSwagger2
public class SgtestApplication {
public static void main(String[] args) {
SpringApplication.run(SgtestApplication.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
.apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
.apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.cloud")))
.apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.security")))
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Single swagger")
.description("API to retrieve swagger apis")
.version("1.0.0")
.build();
}
}
Run Code Online (Sandbox Code Playgroud)
我的资源提供者如下,
@Component
@Primary
@EnableAutoConfiguration
public class GatewaySwaggerResourceProvider implements SwaggerResourcesProvider {
@Autowired
private SwaggerServicesConfig swaggerServiceList;
public GatewaySwaggerResourceProvider() {
}
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> resources = new ArrayList<>(); …Run Code Online (Sandbox Code Playgroud)