0
votes

I work with Spring to create microservices. I am using Eureka for service discovery and Zuul for routing. Now I wanted to switch to Spring Cloud Gateway (because of non-blocking nature) but I've failed to figure out a way of auto routing to each Eureka service.

For example if one service 'eureka-client' registers to Eureka, Zuul does provide a path like localhost:8762/eureka-client to this service by itself. With Spring Cloud Gateway, I've to create a route all by myself for each service.

      routes:
      - id: eureka-client
        uri: lb://eureka-client
        predicates:
        - Path=/eureka-client/**

With a few services that's acceptable but I might get hundreds of services in the end. And each has to write its own route in Spring Cloud Gateway.

Is there a way to provide auto routing from Spring Cloud Gateway to each service from Eureka?

1

1 Answers

2
votes

The auto routing can be configured.

spring.cloud.gateway.discovery.locator.enabled=true