diff --git a/1.2.x/multi/multi__spring_cloud_commons_common_abstractions.html b/1.2.x/multi/multi__spring_cloud_commons_common_abstractions.html index 8cc3a0f3..c588739a 100644 --- a/1.2.x/multi/multi__spring_cloud_commons_common_abstractions.html +++ b/1.2.x/multi/multi__spring_cloud_commons_common_abstractions.html @@ -1,6 +1,6 @@
-Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration +2. Spring Cloud Commons: Common Abstractions \ No newline at end of file +the full strength JCE extensions in your JVM.Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
Commons provides the
@EnableDiscoveryClientannotation. This looks for implementations of theDiscoveryClientinterface viaMETA-INF/spring.factories. Implementations of Discovery Client will add a configuration class tospring.factoriesunder theorg.springframework.cloud.client.discovery.EnableDiscoveryClientkey. Examples ofDiscoveryClientimplementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.By default, implementations of
DiscoveryClientwill auto-register the local Spring Boot server with the remote discovery server. This can be disabled by settingautoRegister=falsein@EnableDiscoveryClient.Commons now provides a
ServiceRegistryinterface which provides methods likeregister(Registration)andderegister(Registration)which allow you to provide custom registered services.Registrationis a marker interface.@Configuration @EnableDiscoveryClient(autoRegister=false) public class MyConfiguration { private ServiceRegistry registry; @@ -75,7 +75,7 @@ the@LoadBalancedqualifier when you create yourpublic String doStuff() { - return restTemplate.getForObject("http://example.com", String.class); + return restTemplate.getForObject("https://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.
spring: diff --git a/1.2.x/multi/multi__spring_cloud_context_application_context_services.html b/1.2.x/multi/multi__spring_cloud_context_application_context_services.html index cdbb4381..e0feadb9 100644 --- a/1.2.x/multi/multi__spring_cloud_context_application_context_services.html +++ b/1.2.x/multi/multi__spring_cloud_context_application_context_services.html @@ -187,4 +187,4 @@ application context gets theEnvironment. To use th features in an application you need to include Spring Security RSA in your classpath (Maven co-ordinates "org.springframework.security:spring-security-rsa") and you also need -the full strength JCE extensions in your JVM.If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
For a Spring Boot Actuator application there are some additional management endpoints:
- POST to
/envto update theEnvironmentand rebind@ConfigurationPropertiesand log levels/refreshfor re-loading the boot strap context and refreshing the@RefreshScopebeans/restartfor closing theApplicationContextand restarting it (disabled by default)/pauseand/resumefor calling theLifecyclemethods (stop()andstart()on theApplicationContext)If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
For a Spring Boot Actuator application there are some additional management endpoints:
/env to update the Environment and rebind @ConfigurationProperties and log levels/refresh for re-loading the boot strap context and refreshing the @RefreshScope beans/restart for closing the ApplicationContext and restarting it (disabled by default)/pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)