Forum Discussion

GarlicBread's avatar
New Member
3 years ago

Add multiple Swagger definitions To Spring Cloud Gateway

I'm trying to add definitions from multiple microservices into my gateway. 


This is what I've done:

public class SwaggerResourcesProviderImpl implements SwaggerResourcesProvider {
    public List<SwaggerResource> get() {
        List<SwaggerResource> resources = new ArrayList<>();
        resources.add(swaggerResource("server-one", "/server-one/v2/api-docs", "0.0.1"));
        resources.add(swaggerResource("server-two", "/server-two/v2/api-docs", "0.0.1"));

    private SwaggerResource swaggerResource(String name, String location, String version) {
        SwaggerResource swaggerResource = new SwaggerResource();
        return swaggerResource;


  • Server-one and Server-two is registered with Eureka, the routes above points to their respective servers.
  • I can access the api-docs of the microservices directly (eg: http://{microservice-one-url}/v2/api-docs)
  • I can access other apis of the microservices through the gateway but not the api-docs

Swagger version:



Thanks in advance for any help.

No RepliesBe the first to reply