The lb:// URI & Discovery Locator
Understand how Spring Cloud Gateway resolves the lb:// scheme through service discovery and how to auto-create routes from registered services.
From Hostnames to Service Names
Hardcoding http://10.0.0.5:8080 breaks when instances move. With service discovery the gateway can target a logical service name instead, and resolve real instances at runtime.
The lb Scheme
Prefix a route's uri with lb:// followed by the service id. The gateway hands the request to the load balancer, which picks a live instance.
routes:
- id: orders
uri: lb://order-service
predicates:
- Path=/orders/**All lessons in this course
- Integrating with Eureka/Consul
- Dynamic Routing with Service Discovery
- Load Balancing with Spring Cloud LoadBalancer
- The lb:// URI & Discovery Locator