@ -492,7 +492,7 @@ public class MyConfiguration {
@@ -492,7 +492,7 @@ public class MyConfiguration {
=== Multiple RestTemplate objects
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:\
To access the load-balanced `RestTemplate`, use the `@LoadBalanced` qualifier when you create your `@Bean`, as shown in the following example:
[source,java,indent=0]
----
@ -513,8 +513,8 @@ public class MyConfiguration {
@@ -513,8 +513,8 @@ public class MyConfiguration {
}
public class MyClass {
@Autowired
private RestTemplate restTemplate;
@Autowired
private RestTemplate restTemplate;
@Autowired
@LoadBalanced
@ -534,6 +534,49 @@ IMPORTANT: Notice the use of the `@Primary` annotation on the plain `RestTemplat
@@ -534,6 +534,49 @@ IMPORTANT: Notice the use of the `@Primary` annotation on the plain `RestTemplat
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`.
=== Multiple WebClient Objects
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: