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?
可以配置自动路由。
spring.cloud.gateway.discovery.locator.enabled=true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.