|feign.autoconfiguration.jackson.enabled | `+++false+++` | If true, PageJacksonModule and SortJacksonModule bean will be provided for Jackson page decoding.
|feign.circuitbreaker.alphanumeric-ids.enabled | `+++false+++` | If true, Circuit Breaker ids will only contain alphanumeric characters to allow for configuration via configuration properties.
|feign.circuitbreaker.enabled | `+++false+++` | If true, an OpenFeign client will be wrapped with a Spring Cloud CircuitBreaker circuit breaker.
|feign.circuitbreaker.group.enabled | `+++false+++` | If true, an OpenFeign client will be wrapped with a Spring Cloud CircuitBreaker circuit breaker with with group.
|feign.circuitbreaker.group.enabled | `+++false+++` | If true, an OpenFeign client will be wrapped with a Spring Cloud CircuitBreaker circuit breaker with group.
|feign.client.config | |
|feign.client.decode-slash | `+++true+++` | Feign clients do not encode slash `/` characters by default. To change this behavior, set the `decodeSlash` to `false`.
|feign.client.default-config | `+++default+++` |
@ -31,8 +31,9 @@
@@ -31,8 +31,9 @@
|feign.httpclient.time-to-live | `+++900+++` |
|feign.httpclient.time-to-live-unit | |
|feign.metrics.enabled | `+++true+++` | Enables metrics capability for Feign.
|feign.oauth2.clientRegistrationId | | Provides a clientRegistrationId to be used with OAuth2.
@ -807,16 +807,26 @@ OAuth2 support can be enabled by setting following flag:
@@ -807,16 +807,26 @@ OAuth2 support can be enabled by setting following flag:
----
feign.oauth2.enabled=true
----
When the flag is set to true, and the oauth2 client context resource details are present, a bean of class `OAuth2FeignRequestInterceptor` is created. Before each request, the interceptor resolves the required access token and includes it as a header.
==== Deprecated OAuth2 Support
When the flag is set to `true`, and `spring-security-oauth2-autoconfigure` is present in the classpath and the oauth2 client context resource details are present and `OAuth2ClientContext` and `OAuth2ProtectedResourceDetails` beans are present, a bean of class `OAuth2FeignRequestInterceptor` is created. Before each request, the interceptor resolves the required access token and includes it as a header.
Sometimes, when load balancing is enabled for Feign clients, you may want to use load balancing for fetching access tokens, too. To do so, you should ensure that the load balancer is on the classpath (spring-cloud-starter-loadbalancer) and explicitly enable load balancing for OAuth2FeignRequestInterceptor by setting the following flag:
----
feign.oauth2.load-balanced=true
----
When the flag is set to true, and the oauth2 client context resource details are present, a bean of class `OAuth2AccessTokenInterceptor` is created. Before each request, the interceptor resolves the required access token and includes it as a header.
`OAuth2AccessTokenInterceptor` uses the `AuthorizedClientServiceOAuth2AuthorizedClientManager` to get `OAuth2AuthorizedClient` that holds an `OAuth2AccessToken`. If the user has specified an OAuth2 `clientRegistrationId` using the `spring.cloud.openfeign.oauth2.clientRegistrationId` property, it will be used to retrieve the token. If the token is not retrieved or the `clientRegistrationId` has not been specified, the `serviceId` retrieved from the `url` host segment will be used.
WARNING:: The OAuth2 support as described above is now deprecated since `spring-security-oauth2-autoconfigure` has reached end of life. Please use the mode described below instead.
==== Current OAuth2 Support
When the `feign.client.refresh-enabled` flag is set to true, and `spring-security-oauth2-client` is present in the classpath, a bean of class `OAuth2AccessTokenInterceptor` is created. Before each request, the interceptor resolves the required access token and includes it as a header.
`OAuth2AccessTokenInterceptor` uses the `OAuth2AuthorizedClientManager` to get `OAuth2AuthorizedClient` that holds an `OAuth2AccessToken`. If the user has specified an OAuth2 `clientRegistrationId` using the `feign.oauth2.clientRegistrationId` property, it will be used to retrieve the token. If the token is not retrieved or the `clientRegistrationId` has not been specified, the `serviceId` retrieved from the `url` host segment will be used.
TIP:: Using the `serviceId` as OAuth2 client registrationId is convenient for load-balanced Feign clients. For non-load-balanced ones, the property-based `clientRegistrationId` is a suitable approach.
TIP:: If you do not want to use the default setup for the `OAuth2AuthorizedClientManager`, you can just instantiate a bean of this type in your configuration.
=== Transform the load-balanced HTTP request
You can use the selected `ServiceInstance` to transform the load-balanced HTTP Request.
@ -70,34 +67,26 @@ public class OAuth2AccessTokenInterceptor implements RequestInterceptor {
@@ -70,34 +67,26 @@ public class OAuth2AccessTokenInterceptor implements RequestInterceptor {
@ -144,9 +133,9 @@ public class OAuth2AccessTokenInterceptor implements RequestInterceptor {
@@ -144,9 +133,9 @@ public class OAuth2AccessTokenInterceptor implements RequestInterceptor {