本文整理汇总了Java中springfox.documentation.swagger.web.SwaggerResource类的典型用法代码示例。如果您正苦于以下问题:Java SwaggerResource类的具体用法?Java SwaggerResource怎么用?Java SwaggerResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SwaggerResource类属于springfox.documentation.swagger.web包,在下文中一共展示了SwaggerResource类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> resources = new ArrayList<>();
//Add the default swagger resource that correspond to the gateway's own swagger doc
resources.add(swaggerResource("default", "/v2/api-docs"));
//Add the registered microservices swagger docs as additional swagger resources
List<Route> routes = routeLocator.getRoutes();
routes.forEach(route -> {
resources.add(swaggerResource(route.getId(), route.getFullPath().replace("**", "v2/api-docs")));
});
return resources;
}
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:16,代码来源:GatewaySwaggerResourcesProvider.java
示例2: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
SwaggerResource swaggerApiResource = new SwaggerResource();
swaggerApiResource.setLocation("/api/swagger");
swaggerApiResource.setSwaggerVersion("2.0");
swaggerApiResource.setName("API");
SwaggerResource swaggerManagementResource = new SwaggerResource();
swaggerManagementResource.setLocation("/api/management");
swaggerManagementResource.setSwaggerVersion("2.0");
swaggerManagementResource.setName("Management");
return Stream.of(swaggerApiResource, swaggerManagementResource).collect(Collectors.toList());
}
示例3: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> resources = super.get();
SwaggerResource springTimeResource = new SwaggerResource();
springTimeResource.setName("SpringTime");
springTimeResource.setLocation("/v2/rfc-api-docs");
resources.add(0, springTimeResource);
return resources;
}
示例4: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> resources = new ArrayList<>();
//Add the registry swagger resource that correspond to the jhipster-registry's own swagger doc
resources.add(swaggerResource("jhipster-registry", "/v2/api-docs"));
//Add the registered microservices swagger docs as additional swagger resources
List<Route> routes = routeLocator.getRoutes();
routes.forEach(route -> {
resources.add(swaggerResource(route.getId(), route.getFullPath().replace("**", "v2/api-docs")));
});
return resources;
}
示例5: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
List<SwaggerResource> resources = new ArrayList<>();
swaggerServices.getServices().forEach(service -> {
resources.add(buildSwaggerResource(service.getName(), service.getUrl(), service.getVersion()));
});
return resources;
}
示例6: buildSwaggerResource
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
private SwaggerResource buildSwaggerResource(String name, String location, String version) {
SwaggerResource swaggerResource = new SwaggerResource();
swaggerResource.setName(name);
swaggerResource.setLocation(location);
swaggerResource.setSwaggerVersion(version);
return swaggerResource;
}
示例7: createResource
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
private static SwaggerResource createResource(String service, String urlLocation, String version){
SwaggerResource resource = new SwaggerResource();
resource.setName(service);
resource.setLocation(urlLocation);
resource.setSwaggerVersion(version);
return resource;
}
示例8: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
public List<SwaggerResource> get() {
List<SwaggerResource> resources = new ArrayList<SwaggerResource>();
if (discoveryClient != null) {
//eureka discovery cliend found
List<String> services = discoveryClient.getServices();
if (services != null && !services.isEmpty()) {
//there are some services
UriComponents current = null;
if (swaggerHost==null || swaggerHost.length()==0) {
//obtain current uri from request
current = ServletUriComponentsBuilder.fromCurrentRequest().build();
}
for (String service : services) {
if (eurekaSkipServices!=null && eurekaSkipServices.size()!=0){
if (eurekaSkipServices.contains(service)){
continue;
}
}
List<ServiceInstance> instances = discoveryClient.getInstances(service);
if (instances.size() != 0) {
ServiceInstance instance = instances.get(0);
//filters metadata called swagger
if (!metadataFilter || instance.getMetadata().containsKey("swagger")) {
String urlLocation = obtainUrlLocation(instance, current, baseSwaggerDefaultUrl, swaggerHost);
resources.add(createResource(service, urlLocation, baseSwaggerDefaultVersion));
}
}
}
}
}else{
//return default swagger group
resources.add(createResource(baseSwaggerDefaultGroup,baseSwaggerDefaultGroup,baseSwaggerDefaultVersion));
}
Collections.sort(resources);
return resources;
}
示例9: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
SwaggerResource jerseySwaggerResource = new SwaggerResource();
jerseySwaggerResource.setLocation(CoreApi.API_ROOT_CONTEXT + "/swagger.json");
jerseySwaggerResource.setSwaggerVersion("2.0");
jerseySwaggerResource.setName("Auto-scaling API");
return Stream.concat(Stream.of(jerseySwaggerResource), inMemorySwaggerResourcesProvider.get().stream()).collect(Collectors.toList());
}
示例10: get
import springfox.documentation.swagger.web.SwaggerResource; //导入依赖的package包/类
@Override
public List<SwaggerResource> get() {
SwaggerResource jerseySwaggerResource = new SwaggerResource();
jerseySwaggerResource.setLocation(CoreApi.API_ROOT_CONTEXT + "/swagger.json");
jerseySwaggerResource.setSwaggerVersion("2.0");
jerseySwaggerResource.setName("Cloudbreak API");
return Stream.concat(Stream.of(jerseySwaggerResource), inMemorySwaggerResourcesProvider.get().stream()).collect(Collectors.toList());
}