Fix gh 491 gh 553 non reactive loadbalancer client (#590)
* Provide non-reactive LB client implemenation to use with RestTemplate. Fixes gh-491. Fixes gh-553. * Add javadoc.
This commit is contained in:
committed by
GitHub
parent
3f17c0d902
commit
c60df0f18e
@@ -336,7 +336,7 @@ For instance, Eureka's supported statuses are `UP`, `DOWN`, `OUT_OF_SERVICE`, an
|
||||
|
||||
=== Spring RestTemplate as a Load Balancer Client
|
||||
|
||||
`RestTemplate` can be automatically configured to use ribbon.
|
||||
`RestTemplate` can be automatically configured to use a Load-balancer client under the hood.
|
||||
To create a load-balanced `RestTemplate`, create a `RestTemplate` `@Bean` and use the `@LoadBalanced` qualifier, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
@@ -369,6 +369,15 @@ The URI needs to use a virtual host name (that is, a service name, not a host na
|
||||
The Ribbon client is used to create a full physical address.
|
||||
See {githubroot}/spring-cloud-netflix/blob/master/spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonAutoConfiguration.java[RibbonAutoConfiguration] for details of how the `RestTemplate` is set up.
|
||||
|
||||
IMPORTANT: In order to use a load-balanced `RestTemplate`, you need to have a load-balancer implementation in your classpath.
|
||||
The recommended implementation is `BlockingLoadBalancerClient`
|
||||
- add `org.springframework.cloud:spring-cloud-loadbalancer` in order to use it.
|
||||
The
|
||||
`RibbonLoadBalancerClient` also can be used, but it's now under maintenance and we do not recommend adding it to new projects.
|
||||
|
||||
WARNING: If you want to use `BlockingLoadBalancerClient`, make sure you do not have
|
||||
`RibbonLoadBalancerClient` in the project classpath, as for backward compatibility reasons, it will be used by default.
|
||||
|
||||
=== Spring WebClient as a Load Balancer Client
|
||||
|
||||
`WebClient` can be automatically configured to use a load-balancer client.
|
||||
|
||||
Reference in New Issue
Block a user