java.lang.IllegalArgumentException: Can not set
diff --git a/reference/html/index.html b/reference/html/index.html index fa7bd6ff..e33efef6 100644 --- a/reference/html/index.html +++ b/reference/html/index.html @@ -136,21 +136,22 @@ $(addBlockSwitches);
If you want a RestTemplate that is not load-balanced, create a RestTemplate bean and inject it.
-To access the load-balanced RestTemplate, use the @LoadBalanced qualifier when you create your @Bean, as shown in the following example:\
RestTemplate, use the @LoadBalanced qualifier when you create your @Bean, as shown in the following example:
java.lang.IllegalArgumentException: Can not set
If you want a WebClient that is not load-balanced, create a WebClient bean and inject it.
+To access the load-balanced WebClient, use the @LoadBalanced qualifier when you create your @Bean, as shown in the following example:
@Configuration
+public class MyConfiguration {
+
+ @LoadBalanced
+ @Bean
+ WebClient.Builder loadBalanced() {
+ return WebClient.builder();
+ }
+
+ @Primary
+ @Bean
+ WebClient.Builder webClient() {
+ return WebClient.builder();
+ }
+}
+
+public class MyClass {
+ @Autowired
+ private WebClient.Builder webClientBuilder;
+
+ @Autowired
+ @LoadBalanced
+ private WebClient.Builder loadBalanced;
+
+ public Mono<String> doOtherStuff() {
+ return loadBalanced.build().get().uri("http://stores/stores")
+ .retrieve().bodyToMono(String.class);
+ }
+
+ public Mono<String> doStuff() {
+ return webClientBuilder.build().get().uri("http://example.com")
+ .retrieve().bodyToMono(String.class);
+ }
+}
+WebClient can be configured to use the ReactiveLoadBalancer.
If you add Spring Cloud LoadBalancer starter to your project,
@@ -1070,7 +1116,7 @@ to false.
If you you don’t have Spring Cloud LoadBalancer starter in your project,
but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction
@@ -1101,15 +1147,14 @@ The following example shows how to configure a WebClient to use loa
The LoadBalancerClient is used to create a full physical address.
WARN: -This approach is now deprecated. +
WARN: This approach is now deprecated. We suggest you use WebFlux with reactive Load-Balancer instead.
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.
@@ -1157,7 +1202,7 @@ The following configuration ignores the docker0 interface and all i
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory) and OK HTTP clients (OkHttpClientFactory).
The OkHttpClientFactory bean is created only if the OK HTTP jar is on the classpath.
@@ -1168,14 +1213,14 @@ You can also disable the creation of these beans by setting spring.cloud.h
Spring Cloud Commons provides a /features actuator endpoint.
This endpoint returns features available on the classpath and whether they are enabled.
The information returned includes the feature type, name, version, and vendor.
There are two types of 'features': abstract and named.
bean.getClass().getPackage().getImplementationVer
Any module can declare any number of HasFeature beans, as shown in the following examples:
Due to the fact that some users have problem with setting up Spring Cloud application, we’ve decided to add a compatibility verification mechanism. It will break if your current setup is not compatible diff --git a/reference/html/spring-cloud-commons.html b/reference/html/spring-cloud-commons.html index fa7bd6ff..e33efef6 100644 --- a/reference/html/spring-cloud-commons.html +++ b/reference/html/spring-cloud-commons.html @@ -136,21 +136,22 @@ $(addBlockSwitches);
If you want a RestTemplate that is not load-balanced, create a RestTemplate bean and inject it.
-To access the load-balanced RestTemplate, use the @LoadBalanced qualifier when you create your @Bean, as shown in the following example:\
RestTemplate, use the @LoadBalanced qualifier when you create your @Bean, as shown in the following example:
java.lang.IllegalArgumentException: Can not set
If you want a WebClient that is not load-balanced, create a WebClient bean and inject it.
+To access the load-balanced WebClient, use the @LoadBalanced qualifier when you create your @Bean, as shown in the following example:
@Configuration
+public class MyConfiguration {
+
+ @LoadBalanced
+ @Bean
+ WebClient.Builder loadBalanced() {
+ return WebClient.builder();
+ }
+
+ @Primary
+ @Bean
+ WebClient.Builder webClient() {
+ return WebClient.builder();
+ }
+}
+
+public class MyClass {
+ @Autowired
+ private WebClient.Builder webClientBuilder;
+
+ @Autowired
+ @LoadBalanced
+ private WebClient.Builder loadBalanced;
+
+ public Mono<String> doOtherStuff() {
+ return loadBalanced.build().get().uri("http://stores/stores")
+ .retrieve().bodyToMono(String.class);
+ }
+
+ public Mono<String> doStuff() {
+ return webClientBuilder.build().get().uri("http://example.com")
+ .retrieve().bodyToMono(String.class);
+ }
+}
+WebClient can be configured to use the ReactiveLoadBalancer.
If you add Spring Cloud LoadBalancer starter to your project,
@@ -1070,7 +1116,7 @@ to false.
If you you don’t have Spring Cloud LoadBalancer starter in your project,
but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction
@@ -1101,15 +1147,14 @@ The following example shows how to configure a WebClient to use loa
The LoadBalancerClient is used to create a full physical address.
WARN: -This approach is now deprecated. +
WARN: This approach is now deprecated. We suggest you use WebFlux with reactive Load-Balancer instead.
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.
@@ -1157,7 +1202,7 @@ The following configuration ignores the docker0 interface and all i
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory) and OK HTTP clients (OkHttpClientFactory).
The OkHttpClientFactory bean is created only if the OK HTTP jar is on the classpath.
@@ -1168,14 +1213,14 @@ You can also disable the creation of these beans by setting spring.cloud.h
Spring Cloud Commons provides a /features actuator endpoint.
This endpoint returns features available on the classpath and whether they are enabled.
The information returned includes the feature type, name, version, and vendor.
There are two types of 'features': abstract and named.
bean.getClass().getPackage().getImplementationVer
Any module can declare any number of HasFeature beans, as shown in the following examples:
Due to the fact that some users have problem with setting up Spring Cloud application, we’ve decided to add a compatibility verification mechanism. It will break if your current setup is not compatible