当前位置: 首页>>代码示例>>Java>>正文


Java SwaggerResource类代码示例

本文整理汇总了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());
}
 
开发者ID:groovylabs,项目名称:lyre,代码行数:16,代码来源:SwaggerConfiguration.java

示例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;
}
 
开发者ID:springside,项目名称:springtime,代码行数:10,代码来源:SpringTimeSwaggerProvider.java

示例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;
}
 
开发者ID:jhipster,项目名称:jhipster-registry,代码行数:16,代码来源:RegistrySwaggerResourcesProvider.java

示例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;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:GatewaySwaggerResourceProvider.java

示例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;	
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:8,代码来源:GatewaySwaggerResourceProvider.java

示例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;
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:8,代码来源:EurekaSwaggerResourcesProvider.java

示例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;

}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:40,代码来源:EurekaSwaggerResourcesProvider.java

示例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());
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:11,代码来源:CombinedSwaggerResourcesProvider.java

示例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());
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:11,代码来源:CombinedSwaggerResourcesProvider.java


注:本文中的springfox.documentation.swagger.web.SwaggerResource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。