From c09ebb82cafe30cc2cd98899ffe533dea0dbefff Mon Sep 17 00:00:00 2001 From: buildmaster Date: Mon, 2 Sep 2019 18:39:37 +0000 Subject: [PATCH] Sync docs from 2.1.x to gh-pages --- ...ing_cloud_commons_common_abstractions.html | 67 +++++++++++++- 2.1.x/multi/multi_spring-cloud-commons.html | 2 +- 2.1.x/single/spring-cloud-commons.html | 69 ++++++++++++-- 2.1.x/spring-cloud-commons.xml | 92 ++++++++++++++++++- 4 files changed, 215 insertions(+), 15 deletions(-) diff --git a/2.1.x/multi/multi__spring_cloud_commons_common_abstractions.html b/2.1.x/multi/multi__spring_cloud_commons_common_abstractions.html index 3730cea2..045022dc 100644 --- a/2.1.x/multi/multi__spring_cloud_commons_common_abstractions.html +++ b/2.1.x/multi/multi__spring_cloud_commons_common_abstractions.html @@ -47,7 +47,7 @@ Calling /service-registry with GET returns the stat Using POST to the same endpoint with a JSON body changes the status of the current Registration to the new value. The JSON body has to include the status field with the preferred value. Please see the documentation of the ServiceRegistry implementation you use for the allowed values when updating the status and the values returned for the status. -For instance, Eureka’s supported statuses are UP, DOWN, OUT_OF_SERVICE, and UNKNOWN.

2.3 Spring RestTemplate as a Load Balancer Client

RestTemplate can be automatically configured to use ribbon. +For instance, Eureka’s supported statuses are UP, DOWN, OUT_OF_SERVICE, and UNKNOWN.

2.3 Spring RestTemplate as a Load Balancer Client

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:

@Configuration
 public class MyConfiguration {
 
@@ -69,7 +69,12 @@ To create a load-balanced RestTemplate, create a 
[Caution]Caution

A RestTemplate bean is no longer created through auto-configuration. Individual applications must create it.

The URI needs to use a virtual host name (that is, a service name, not a host name). The Ribbon client is used to create a full physical address. -See RibbonAutoConfiguration for details of how the RestTemplate is set up.

2.4 Spring WebClient as a Load Balancer Client

WebClient can be automatically configured to use the LoadBalancerClient. +See RibbonAutoConfiguration for details of how the RestTemplate is set up.

[Important]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]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.

2.4 Spring WebClient as a Load Balancer Client

WebClient can be automatically configured to use a load-balancer client. To create a load-balanced WebClient, create a WebClient.Builder @Bean and use the @LoadBalanced qualifier, as shown in the following example:

@Configuration
 public class MyConfiguration {
 
@@ -89,7 +94,17 @@ To create a load-balanced WebClient, create a class);
     }
 }

The URI needs to use a virtual host name (that is, a service name, not a host name). -The Ribbon client is used to create a full physical address.

2.4.1 Retrying Failed Requests

A load-balanced RestTemplate can be configured to retry failed requests. +The Ribbon client is used to create a full physical address.

[Important]Important

If you want to use a @LoadBalanced WebClient.Builder, you need to have a loadbalancer +implementation in the classpath. It is recommended that you add the +org.springframework.cloud:spring-cloud-loadbalancer dependency to your project. +Then, ReactiveLoadBalancer will be used underneath. +Alternatively, this functionality will also work with spring-cloud-starter-netflix-ribbon, but the request +will be handled by a non-reactive LoadBalancerClient under the hood. Additionally, +spring-cloud-starter-netflix-ribbon is already in maintenance mode, so we do not recommned +adding it to new projects.

[Tip]Tip

The ReactorLoadBalancer used underneath supports caching. If cacheManager is detected, +cached version of ServiceInstanceSupplier will be used. If not, we will retrieve instances +from discovery service without caching them. We recommend enabling caching in your project +if you use ReactiveLoadBalancer.

2.4.1 Retrying Failed Requests

A load-balanced RestTemplate can be configured to retry failed requests. By default, this logic is disabled. You can enable it by adding Spring Retry to your application’s classpath. The load-balanced RestTemplate honors some of the Ribbon configuration values related to retrying failed requests. @@ -167,7 +182,28 @@ To access the load-balanced RestTemplate, use the < public String doStuff() { return restTemplate.getForObject("https://example.com", String.class); } -}

[Important]Important

Notice the use of the @Primary annotation on the plain RestTemplate declaration in the preceding example to disambiguate the unqualified @Autowired injection.

[Tip]Tip

If you see errors such as java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89, try injecting RestOperations or setting spring.aop.proxyTargetClass=true.

2.6 Spring WebFlux WebClient as a Load Balancer Client

WebClient can be configured to use the LoadBalancerClient. LoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. The following example shows how to configure a WebClient to use load balancer:

public class MyClass {
+}
[Important]Important

Notice the use of the @Primary annotation on the plain RestTemplate declaration in the preceding example to disambiguate the unqualified @Autowired injection.

[Tip]Tip

If you see errors such as java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89, try injecting RestOperations or setting spring.aop.proxyTargetClass=true.

2.6 Spring WebFlux WebClient as a Load Balancer Client

2.6.1 Spring WebFlux WebClient with Reactive Load Balancer

WebClient can be configured to use the ReactiveLoadBalancer. +If you add org.springframework.cloud:spring-cloud-loadbalancer to your project, + ReactorLoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. +The following example shows how to configure a WebClient to use reactive load balancer under the hood:

public class MyClass {
+    @Autowired
+    private ReactorLoadBalancerExchangeFilterFunction lbFunction;
+
+    public Mono<String> doOtherStuff() {
+        return WebClient.builder().baseUrl("http://stores")
+            .filter(lbFunction)
+            .build()
+            .get()
+            .uri("/stores")
+            .retrieve()
+            .bodyToMono(String.class);
+    }
+}

The URI needs to use a virtual host name (that is, a service name, not a host name). +The ReactorLoadBalancerClient is used to create a full physical address.

2.6.2 Spring WebFlux WebClient with non-reactive Load Balancer Client

If you you don’t have org.springframework.cloud:spring-cloud-loadbalancer in your project, +but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction +will be auto-configured if spring-webflux is on the classpath. Please note, however, that this is +uses a non-reactive client under the hood. +The following example shows how to configure a WebClient to use load balancer:

public class MyClass {
     @Autowired
     private LoadBalancerExchangeFilterFunction lbFunction;
 
@@ -181,7 +217,28 @@ To access the load-balanced RestTemplate, use the <
             .bodyToMono(String.class);
     }
 }

The URI needs to use a virtual host name (that is, a service name, not a host name). -The LoadBalancerClient is used to create a full physical address.

2.7 Ignore Network Interfaces

Sometimes, it is useful to ignore certain named network interfaces so that they can be excluded from Service Discovery registration (for example, when running in a Docker container). +The LoadBalancerClient is used to create a full physical address.

WARN: +This approach is now deprecated. +We suggest you use WebFlux with reactive Load-Balancer +instead.

2.6.3 Passing your own Load-Balancer Client configuration

You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so:

@Configuration
+@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class)
+public class MyConfiguration {
+
+	@Bean
+	@LoadBalanced
+	public WebClient.Builder loadBalancedWebClientBuilder() {
+		return WebClient.builder();
+	}
+}

It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below:

@Configuration
+@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)})
+public class MyConfiguration {
+
+	@Bean
+	@LoadBalanced
+	public WebClient.Builder loadBalancedWebClientBuilder() {
+		return WebClient.builder();
+	}
+}

2.7 Ignore Network Interfaces

Sometimes, it is useful to ignore certain named network interfaces so that they can be excluded from Service Discovery registration (for example, when running in a Docker container). A list of regular expressions can be set to cause the desired network interfaces to be ignored. The following configuration ignores the docker0 interface and all interfaces that start with veth:

application.yml. 

spring:
diff --git a/2.1.x/multi/multi_spring-cloud-commons.html b/2.1.x/multi/multi_spring-cloud-commons.html
index c67ac9f2..7f6241a4 100644
--- a/2.1.x/multi/multi_spring-cloud-commons.html
+++ b/2.1.x/multi/multi_spring-cloud-commons.html
@@ -1,3 +1,3 @@
 
       
-   Cloud Native Applications
\ No newline at end of file
+   Cloud Native Applications
\ No newline at end of file
diff --git a/2.1.x/single/spring-cloud-commons.html b/2.1.x/single/spring-cloud-commons.html
index 81305a85..1758d824 100644
--- a/2.1.x/single/spring-cloud-commons.html
+++ b/2.1.x/single/spring-cloud-commons.html
@@ -1,6 +1,6 @@
 
       
-   Cloud Native Applications

Cloud Native Applications


Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. + Cloud Native Applications

Cloud Native Applications


Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Applications, in which development practices are aligned with delivery and operations goals — for instance, by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways. The starting point is a set of features to which all components in a distributed system need easy access.

Many of those features are covered by Spring Boot, on which Spring Cloud builds. Some more features are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. @@ -146,7 +146,7 @@ Calling /service-registry with GET returns the stat Using POST to the same endpoint with a JSON body changes the status of the current Registration to the new value. The JSON body has to include the status field with the preferred value. Please see the documentation of the ServiceRegistry implementation you use for the allowed values when updating the status and the values returned for the status. -For instance, Eureka’s supported statuses are UP, DOWN, OUT_OF_SERVICE, and UNKNOWN.

2.3 Spring RestTemplate as a Load Balancer Client

RestTemplate can be automatically configured to use ribbon. +For instance, Eureka’s supported statuses are UP, DOWN, OUT_OF_SERVICE, and UNKNOWN.

2.3 Spring RestTemplate as a Load Balancer Client

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:

@Configuration
 public class MyConfiguration {
 
@@ -168,7 +168,12 @@ To create a load-balanced RestTemplate, create a 
[Caution]Caution

A RestTemplate bean is no longer created through auto-configuration. Individual applications must create it.

The URI needs to use a virtual host name (that is, a service name, not a host name). The Ribbon client is used to create a full physical address. -See RibbonAutoConfiguration for details of how the RestTemplate is set up.

2.4 Spring WebClient as a Load Balancer Client

WebClient can be automatically configured to use the LoadBalancerClient. +See RibbonAutoConfiguration for details of how the RestTemplate is set up.

[Important]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]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.

2.4 Spring WebClient as a Load Balancer Client

WebClient can be automatically configured to use a load-balancer client. To create a load-balanced WebClient, create a WebClient.Builder @Bean and use the @LoadBalanced qualifier, as shown in the following example:

@Configuration
 public class MyConfiguration {
 
@@ -188,7 +193,17 @@ To create a load-balanced WebClient, create a class);
     }
 }

The URI needs to use a virtual host name (that is, a service name, not a host name). -The Ribbon client is used to create a full physical address.

2.4.1 Retrying Failed Requests

A load-balanced RestTemplate can be configured to retry failed requests. +The Ribbon client is used to create a full physical address.

[Important]Important

If you want to use a @LoadBalanced WebClient.Builder, you need to have a loadbalancer +implementation in the classpath. It is recommended that you add the +org.springframework.cloud:spring-cloud-loadbalancer dependency to your project. +Then, ReactiveLoadBalancer will be used underneath. +Alternatively, this functionality will also work with spring-cloud-starter-netflix-ribbon, but the request +will be handled by a non-reactive LoadBalancerClient under the hood. Additionally, +spring-cloud-starter-netflix-ribbon is already in maintenance mode, so we do not recommned +adding it to new projects.

[Tip]Tip

The ReactorLoadBalancer used underneath supports caching. If cacheManager is detected, +cached version of ServiceInstanceSupplier will be used. If not, we will retrieve instances +from discovery service without caching them. We recommend enabling caching in your project +if you use ReactiveLoadBalancer.

2.4.1 Retrying Failed Requests

A load-balanced RestTemplate can be configured to retry failed requests. By default, this logic is disabled. You can enable it by adding Spring Retry to your application’s classpath. The load-balanced RestTemplate honors some of the Ribbon configuration values related to retrying failed requests. @@ -266,7 +281,28 @@ To access the load-balanced RestTemplate, use the < public String doStuff() { return restTemplate.getForObject("https://example.com", String.class); } -}

[Important]Important

Notice the use of the @Primary annotation on the plain RestTemplate declaration in the preceding example to disambiguate the unqualified @Autowired injection.

[Tip]Tip

If you see errors such as java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89, try injecting RestOperations or setting spring.aop.proxyTargetClass=true.

2.6 Spring WebFlux WebClient as a Load Balancer Client

WebClient can be configured to use the LoadBalancerClient. LoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. The following example shows how to configure a WebClient to use load balancer:

public class MyClass {
+}
[Important]Important

Notice the use of the @Primary annotation on the plain RestTemplate declaration in the preceding example to disambiguate the unqualified @Autowired injection.

[Tip]Tip

If you see errors such as java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89, try injecting RestOperations or setting spring.aop.proxyTargetClass=true.

2.6 Spring WebFlux WebClient as a Load Balancer Client

2.6.1 Spring WebFlux WebClient with Reactive Load Balancer

WebClient can be configured to use the ReactiveLoadBalancer. +If you add org.springframework.cloud:spring-cloud-loadbalancer to your project, + ReactorLoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. +The following example shows how to configure a WebClient to use reactive load balancer under the hood:

public class MyClass {
+    @Autowired
+    private ReactorLoadBalancerExchangeFilterFunction lbFunction;
+
+    public Mono<String> doOtherStuff() {
+        return WebClient.builder().baseUrl("http://stores")
+            .filter(lbFunction)
+            .build()
+            .get()
+            .uri("/stores")
+            .retrieve()
+            .bodyToMono(String.class);
+    }
+}

The URI needs to use a virtual host name (that is, a service name, not a host name). +The ReactorLoadBalancerClient is used to create a full physical address.

2.6.2 Spring WebFlux WebClient with non-reactive Load Balancer Client

If you you don’t have org.springframework.cloud:spring-cloud-loadbalancer in your project, +but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction +will be auto-configured if spring-webflux is on the classpath. Please note, however, that this is +uses a non-reactive client under the hood. +The following example shows how to configure a WebClient to use load balancer:

public class MyClass {
     @Autowired
     private LoadBalancerExchangeFilterFunction lbFunction;
 
@@ -280,7 +316,28 @@ To access the load-balanced RestTemplate, use the <
             .bodyToMono(String.class);
     }
 }

The URI needs to use a virtual host name (that is, a service name, not a host name). -The LoadBalancerClient is used to create a full physical address.

2.7 Ignore Network Interfaces

Sometimes, it is useful to ignore certain named network interfaces so that they can be excluded from Service Discovery registration (for example, when running in a Docker container). +The LoadBalancerClient is used to create a full physical address.

WARN: +This approach is now deprecated. +We suggest you use WebFlux with reactive Load-Balancer +instead.

2.6.3 Passing your own Load-Balancer Client configuration

You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so:

@Configuration
+@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class)
+public class MyConfiguration {
+
+	@Bean
+	@LoadBalanced
+	public WebClient.Builder loadBalancedWebClientBuilder() {
+		return WebClient.builder();
+	}
+}

It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below:

@Configuration
+@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)})
+public class MyConfiguration {
+
+	@Bean
+	@LoadBalanced
+	public WebClient.Builder loadBalancedWebClientBuilder() {
+		return WebClient.builder();
+	}
+}

2.7 Ignore Network Interfaces

Sometimes, it is useful to ignore certain named network interfaces so that they can be excluded from Service Discovery registration (for example, when running in a Docker container). A list of regular expressions can be set to cause the desired network interfaces to be ignored. The following configuration ignores the docker0 interface and all interfaces that start with veth:

application.yml. 

spring:
diff --git a/2.1.x/spring-cloud-commons.xml b/2.1.x/spring-cloud-commons.xml
index 4ef50dad..eaa5a2c3 100644
--- a/2.1.x/spring-cloud-commons.xml
+++ b/2.1.x/spring-cloud-commons.xml
@@ -365,7 +365,7 @@ For instance, Eureka’s supported statuses are UP, 
 
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: @Configuration public class MyConfiguration { @@ -393,10 +393,21 @@ Individual applications must create it. The URI needs to use a virtual host name (that is, a service name, not a host name). The Ribbon client is used to create a full physical address. See RibbonAutoConfiguration for details of how the RestTemplate is set up. + +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. + + +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 the LoadBalancerClient. +WebClient can be automatically configured to use a load-balancer client. To create a load-balanced WebClient, create a WebClient.Builder @Bean and use the @LoadBalanced qualifier, as shown in the following example: @Configuration public class MyConfiguration { @@ -419,6 +430,22 @@ public class MyClass { } The URI needs to use a virtual host name (that is, a service name, not a host name). The Ribbon client is used to create a full physical address. + +If you want to use a @LoadBalanced WebClient.Builder, you need to have a loadbalancer +implementation in the classpath. It is recommended that you add the +org.springframework.cloud:spring-cloud-loadbalancer dependency to your project. +Then, ReactiveLoadBalancer will be used underneath. +Alternatively, this functionality will also work with spring-cloud-starter-netflix-ribbon, but the request +will be handled by a non-reactive LoadBalancerClient under the hood. Additionally, +spring-cloud-starter-netflix-ribbon is already in maintenance mode, so we do not recommned +adding it to new projects. + + +The ReactorLoadBalancer used underneath supports caching. If cacheManager is detected, +cached version of ServiceInstanceSupplier will be used. If not, we will retrieve instances +from discovery service without caching them. We recommend enabling caching in your project +if you use ReactiveLoadBalancer. +
Retrying Failed Requests A load-balanced RestTemplate can be configured to retry failed requests. @@ -522,7 +549,36 @@ public class MyClass {
Spring WebFlux WebClient as a Load Balancer Client -WebClient can be configured to use the LoadBalancerClient. LoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. The following example shows how to configure a WebClient to use load balancer: +
+Spring WebFlux WebClient with Reactive Load Balancer +WebClient can be configured to use the ReactiveLoadBalancer. +If you add org.springframework.cloud:spring-cloud-loadbalancer to your project, + ReactorLoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. +The following example shows how to configure a WebClient to use reactive load balancer under the hood: +public class MyClass { + @Autowired + private ReactorLoadBalancerExchangeFilterFunction lbFunction; + + public Mono<String> doOtherStuff() { + return WebClient.builder().baseUrl("http://stores") + .filter(lbFunction) + .build() + .get() + .uri("/stores") + .retrieve() + .bodyToMono(String.class); + } +} +The URI needs to use a virtual host name (that is, a service name, not a host name). +The ReactorLoadBalancerClient is used to create a full physical address. +
+
+Spring WebFlux WebClient with non-reactive Load Balancer Client +If you you don’t have org.springframework.cloud:spring-cloud-loadbalancer in your project, +but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction +will be auto-configured if spring-webflux is on the classpath. Please note, however, that this is +uses a non-reactive client under the hood. +The following example shows how to configure a WebClient to use load balancer: public class MyClass { @Autowired private LoadBalancerExchangeFilterFunction lbFunction; @@ -539,6 +595,36 @@ public class MyClass { } The URI needs to use a virtual host name (that is, a service name, not a host name). The LoadBalancerClient is used to create a full physical address. +WARN: +This approach is now deprecated. +We suggest you use WebFlux with reactive Load-Balancer +instead. +
+
+Passing your own Load-Balancer Client configuration +You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so: +@Configuration +@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class) +public class MyConfiguration { + + @Bean + @LoadBalanced + public WebClient.Builder loadBalancedWebClientBuilder() { + return WebClient.builder(); + } +} +It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below: +@Configuration +@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)}) +public class MyConfiguration { + + @Bean + @LoadBalanced + public WebClient.Builder loadBalancedWebClientBuilder() { + return WebClient.builder(); + } +} +
Ignore Network Interfaces