Add Apache HC5 client option (#498)

This commit is contained in:
Thanh
2021-03-11 14:14:34 +01:00
committed by GitHub
parent 2a23b6d304
commit e3439f38bc
20 changed files with 875 additions and 23 deletions

View File

@@ -24,5 +24,9 @@
|feign.httpclient.time-to-live-unit | |
|feign.hystrix.enabled | `false` | If true, an OpenFeign client will be wrapped with a Hystrix circuit breaker.
|feign.okhttp.enabled | `false` | Enables the use of the OK HTTP Client by Feign.
|===
|feign.httpclient.hc5.enabled | `false` | Enables the use of the Apache HC5 by Feign.
|feign.httpclient.hc5.socket-timeout | `5` |
|feign.httpclient.hc5.socket-timeout-unit | `seconds` |
|feign.httpclient.hc5.pool-reuse-policy | `fifo` | Pooled connection re-use policies
|feign.httpclient.hc5.pool-concurrency-policy | `strict` | Pool concurrency policies
|===

View File

@@ -125,8 +125,8 @@ If none of them is in the classpath, the default feign client is used.
NOTE: `spring-cloud-starter-openfeign` supports both `spring-cloud-starter-netflix-ribbon` and `spring-cloud-starter-loadbalancer`. However, as they are optional dependencies, you need to make sure the one you want to use has been added to your project.
The OkHttpClient and ApacheHttpClient feign clients can be used by setting `feign.okhttp.enabled` or `feign.httpclient.enabled` to `true`, respectively, and having them on the classpath.
You can customize the HTTP client used by providing a bean of either `org.apache.http.impl.client.CloseableHttpClient` when using Apache or `okhttp3.OkHttpClient` when using OK HTTP.
The OkHttpClient and ApacheHttpClient and ApacheHC5 feign clients can be used by setting `feign.okhttp.enabled` or `feign.httpclient.enabled` or `feign.httpclient.hc5.enabled` to `true`, respectively, and having them on the classpath.
You can customize the HTTP client used by providing a bean of either `org.apache.http.impl.client.CloseableHttpClient` when using Apache or `okhttp3.OkHttpClient` when using OK HTTP or `org.apache.hc.client5.http.impl.classic.CloseableHttpClient` when using Apache HC5.
Spring Cloud OpenFeign _does not_ provide the following beans by default for feign, but still looks up beans of these types from the application context to create the feign client: