File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -317,11 +317,23 @@ for details of how the `RestTemplate` is set up.
317
317
=== Multiple RestTemplate objects
318
318
319
319
If you want a `RestTemplate` that is not load balanced, create a `RestTemplate`
320
- bean and inject it as normal. To access the load balanced `RestTemplate use
321
- the provided `@LoadBalanced` `Qualifier`:
320
+ bean and inject it as normal. To access the load balanced `RestTemplate use
321
+ the provided `@LoadBalanced` `Qualifier`.
322
+
323
+ IMPORTANT: Notice the `@Primary` annotation on the plain `RestTemplate` declaration.
322
324
323
325
[source,java,indent=0]
324
326
----
327
+ @Configuration
328
+ public class MyConfiguration {
329
+
330
+ @Primary
331
+ @Bean
332
+ RestTemplate restTemplate() {
333
+ return new RestTemplate();
334
+ }
335
+ }
336
+
325
337
public class MyClass {
326
338
@Autowired
327
339
private RestTemplate restTemplate;
You can’t perform that action at this time.
0 commit comments