-|
- Tip
- |
-
-
Due to Gradle’s dependency resolution rules and the lack of a parent bom feature, simply depending on spring-cloud-starter-eureka-server can cause failures on application startup. To remedy this the Spring dependency management plugin must be added and the Spring cloud starter parent bom must be imported like so:
@@ -2354,6 +2470,30 @@ attribute with a list of @HystrixProperty annotations. See
for more details. See the Hystrix wiki
for details on the properties available.
+
+ Propagating the Security Context or using Spring Scopes
+
+ If you want some thread local context to propagate into a @HystrixCommand the default declaration will not work because it executes the command in a thread pool (in case of timeouts). You can switch Hystrix to use the same thread as the caller using some configuration, or directly in the annotation, by asking it to use a different "Isolation Strategy". For example:
+
+
+
+ @HystrixCommand(fallbackMethod = "stubMyService",
+ commandProperties = {
+ @HystrixProperty(name="execution.isolation.strategy", value="SEMAPHORE")
+ }
+)
+...
+
+
+
+ The same thing applies if you are using @SessionScope or @RequestScope. You will know when you need to do this because of a runtime exception that says it can’t find the scoped context.
+
+
+ In particular you might be interested
+
+
+
+ Health Indicator
The state of the connected circuit breakers are also exposed in the
/health endpoint of the calling application.
@@ -2371,6 +2511,7 @@ for details on the properties available.
}
+
Hystrix Metrics Stream
@@ -2427,7 +2568,7 @@ for details on the properties available.
aggregator:
clusterConfig: SYSTEM,USER
appConfig: customers,stores,ui,admin
- clusterNameExpression: metadata.cluster
+ clusterNameExpression: metadata['cluster']
@@ -2495,7 +2636,7 @@ so if you are using @FeignClient then this section also applies.
A central concept in Ribbon is that of the named client. Each load
balancer is part of an ensemble of components that work together to
-contact a remote server on demend, and the ensemble has a name that
+contact a remote server on demand, and the ensemble has a name that
you give it as an application developer (e.g. using the @FeignClient
annotation). Spring Cloud creates a new ensemble as an
ApplicationContext on demand for each named client using
@@ -2636,6 +2777,21 @@ configuration like this
+ Example: Disable Eureka use in Ribbon
+
+ Setting the property ribbon.eureka.enabled = false will explicitly
+disable the use of Eureka in Ribbon.
+
+
+ application.yml
+
+ ribbon:
+ eureka:
+ enabled: false
+
+
+
+
Using the Ribbon API Directly
You can also use the LoadBalancerClient directly. Example:
@@ -2874,18 +3030,24 @@ level, but "/myusers/**" matches hierarchically.
These simple url-routes doesn’t get executed as HystrixCommand nor can you loadbalance multiple url with Ribbon.
-To achieve this specify a service-route and configure a Ribbon client for the serviceId, e.g.
+To achieve this specify a service-route and configure a Ribbon client for the
+serviceId (this currently requires disabling Eureka support in Ribbon:
+see above for more information), e.g.
application.yml
- zuul:
+zuul:
routes:
users:
path: /myusers/**
serviceId: users
- users:
+ribbon:
+ eureka:
+ enabled: false
+
+users:
ribbon:
listOfServers: example.com,google.com
@@ -2991,6 +3153,18 @@ still specified by configuring "zuul.routes.*", but there is no service discover
+ Disable Zuul Filters
+
+ Zuul for Spring Cloud comes with a number of ZuulFilter beans enabled by default
+in both proxy and server mode. See the zuul filters package for the
+possible filters that are enabled. If you want to disable one, simply set
+zuul.<SimpleClassName>.<filterType>.disable=true. By convention, the package after
+filters is the Zuul filter type. For example to disable
+org.springframework.cloud.netflix.zuul.filters.post.SendResponseFilter set
+zuul.SendResponseFilter.post.disable=true.
+
+
+
Polyglot support with Sidecar
Do you have non-jvm languages you want to take advantage of Eureka, Ribbon and
@@ -3149,6 +3323,14 @@ info:
+ Application Context ID must be unique
+
+
+ The bus tries to eliminate processing an event twice, once from the original ApplicationEvent and once from the queue. To do this, it checks the sending application context id againts the current application context id. If multiple instances of a service have the same application context id, events will not be processed. Running on a local machine, each service will be on a different port and that will be part of the application context id. Cloud Foundry supplies an index to differentiate. To ensure that the application context id is the unique, set spring.application.index to something unique for each instance of a service. For example, in lattice, set spring.application.index=${INSTANCE_INDEX} in application.properties (or bootstrap.properties if using configserver).
+
+
+
+
Customizing the AMQP ConnectionFactory
@@ -3193,7 +3375,7 @@ sure you have
$ spring version
-Spring CLI v1.2.2.RELEASE
+Spring CLI v1.2.3.RELEASE
@@ -3201,8 +3383,8 @@ Spring CLI v1.2.2.RELEASE
- $ gvm install springboot 1.2.2.RELEASE
-$ gvm use springboot 1.2.2.RELEASE
+ $ gvm install springboot 1.2.3.RELEASE
+$ gvm use springboot 1.2.3.RELEASE
@@ -3211,7 +3393,7 @@ $ gvm use springboot 1.2.2.RELEASE
$ mvn install
-$ spring install org.springframework.cloud:spring-cloud-cli:1.0.1.RELEASE
+$ spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE
@@ -3541,6 +3723,16 @@ of AuthorizationCodeResourceDetails so all its properties can be sp
+ Token Type in User Info
+
+ Google (and certain other 3rd party identity providers) is more strict
+about the token type name that is sent in the headers to the user info
+endpoint. The default is "Bearer" which suits most providers and
+matches the spec, but if you need to change it you can set
+spring.oauth2.resource.tokenType.
+
+
+
Customizing the RestTemplate
The SSO (and Resource Server) features use an OAuth2RestTemplate
@@ -3851,7 +4043,7 @@ ProxyAuthenticationProperties] for full details.
|