diff --git a/multi/multi__spring_cloud_commons_common_abstractions.html b/multi/multi__spring_cloud_commons_common_abstractions.html index c03f73a3..e8130565 100644 --- a/multi/multi__spring_cloud_commons_common_abstractions.html +++ b/multi/multi__spring_cloud_commons_common_abstractions.html @@ -58,7 +58,7 @@ you would like to use for a given service.
Note
clientin the above examples should be replaced with your Ribbon client’s -name.If you want a
RestTemplatethat is not load balanced, create aRestTemplate+name.If you want a
RestTemplatethat is not load balanced, create aRestTemplatebean and inject it as normal. To access the load balancedRestTemplateuse the@LoadBalancedqualifier when you create your@Bean.
Important Notice the
@Primaryannotation on the plainRestTemplatedeclaration in the example below, to disambiguate the unqualified@Autowiredinjection.@Configuration public class MyConfiguration { @@ -91,7 +91,21 @@ the@LoadBalancedqualifier when you create yourpublic String doStuff() { return restTemplate.getForObject("http://example.com", String.class); } -}
Tip If you see errors like
java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89try injectingRestOperationsinstead or settingspring.aop.proxyTargetClass=true.Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
application.yml. +}
Tip If you see errors like
java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89try injectingRestOperationsinstead or settingspring.aop.proxyTargetClass=true.
WebClientcan be configured to use theLoadBalancerClient. A `LoadBalancerExchangeFilterFunctionis auto-configured if spring-webflux is on the classpath.public class MyClass { + @Autowired + private LoadBalancerExchangeFilterFunction 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 (ie. service name, not a host name). +The
LoadBalancerClientis used to create a full physical address.Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
application.yml.
spring: cloud: inetutils: diff --git a/multi/multi_spring-cloud-commons.html b/multi/multi_spring-cloud-commons.html index 95bbb5c3..064776f7 100644 --- a/multi/multi_spring-cloud-commons.html +++ b/multi/multi_spring-cloud-commons.html @@ -1,3 +1,3 @@ -Cloud Native Applications \ No newline at end of file +Table of Contents
- 1. Spring Cloud Context: Application Context Services
- 1.1. The Bootstrap Application Context
- 1.2. Application Context Hierarchies
- 1.3. Changing the Location of Bootstrap Properties
- 1.4. Overriding the Values of Remote Properties
- 1.5. Customizing the Bootstrap Configuration
- 1.6. Customizing the Bootstrap Property Sources
- 1.7. Environment Changes
- 1.8. Refresh Scope
- 1.9. Encryption and Decryption
- 1.10. Endpoints
- 2. Spring Cloud Commons: Common Abstractions
Cloud Native Applications Table of Contents
- 1. Spring Cloud Context: Application Context Services
- 1.1. The Bootstrap Application Context
- 1.2. Application Context Hierarchies
- 1.3. Changing the Location of Bootstrap Properties
- 1.4. Overriding the Values of Remote Properties
- 1.5. Customizing the Bootstrap Configuration
- 1.6. Customizing the Bootstrap Property Sources
- 1.7. Environment Changes
- 1.8. Refresh Scope
- 1.9. Encryption and Decryption
- 1.10. Endpoints
- 2. Spring Cloud Commons: Common Abstractions