LoadBalancer
Support to work with spring-cloud-starter-loadbalancer
to achieve client side load balancing.
Enable LoadBalancer
This feature is automatically enabled when the spring-cloud-starter-loadbalancer
is present on the classpath.
- Gradle
- Maven
implementation("org.springframework.cloud:spring-cloud-starter-loadbalancer")
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
Disable LoadBalancer
Set http-exchange.loadbalancer-enabled
to false
to disable the load balancer for all HttpExchange clients.
application.yml
http-exchange:
loadbalancer-enabled: false
Disable for Specific Channel
Disable the load balancer for a specific channel by setting loadbalancer-enabled
to false
.
application.yml
http-exchange:
channels:
- base-url: user
loadbalancer-enabled: false
clients:
- com.example.user.api.*Api
See loadbalancer example.