From 86fb2f8a268baf480e39dc53c8be1d6bccfa1bbb Mon Sep 17 00:00:00 2001 From: Olga MaciaszekSharma Date: Thu, 14 Dec 2023 18:54:54 +0100 Subject: [PATCH] Fix HC5 docs. Fixes gh-887. --- docs/src/main/asciidoc/spring-cloud-openfeign.adoc | 4 +++- .../META-INF/additional-spring-configuration-metadata.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-openfeign.adoc b/docs/src/main/asciidoc/spring-cloud-openfeign.adoc index f365ef05..eabdc13d 100644 --- a/docs/src/main/asciidoc/spring-cloud-openfeign.adoc +++ b/docs/src/main/asciidoc/spring-cloud-openfeign.adoc @@ -140,7 +140,9 @@ If none of them is on the classpath, the default feign client is used. NOTE: `spring-cloud-starter-openfeign` supports `spring-cloud-starter-loadbalancer`. However, as is an optional dependency, you need to make sure it has been added to your project if you want to use it. -The OkHttpClient and Apache HttpClient 5 Feign clients can be used by setting `spring.cloud.openfeign.okhttp.enabled` or `spring.cloud.openfeign.httpclient.hc5.enabled` to `true`, respectively, and having them on the classpath. +To use OkHttpClient-backed Feign clients, make sure OKHttpClient is on your classpath and set `spring.cloud.openfeign.okhttp.enabled` to `true`. + +When it comes to the Apache HttpClient 5-backed Feign clients, it's enough to ensure HttpClient 5 is on the classpath, but you can still disable its use for Feign Clients by setting `spring.cloud.openfeign.httpclient.hc5.enabled` to `false`. You can customize the HTTP client used by providing a bean of either `org.apache.hc.client5.http.impl.classic.CloseableHttpClient` when using Apache HC5. You can further customise http clients by setting values in the `spring.cloud.openfeign.httpclient.xxx` properties. The ones prefixed just with `httpclient` will work for all the clients, the ones prefixed with `httpclient.hc5` to Apache HttpClient 5 and the ones prefixed with `httpclient.okhttp` to OkHttpClient. You can find a full list of properties you can customise in the appendix. diff --git a/spring-cloud-openfeign-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-openfeign-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 5e91825d..c80758c6 100644 --- a/spring-cloud-openfeign-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-openfeign-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -36,7 +36,7 @@ "name": "spring.cloud.openfeign.httpclient.hc5.enabled", "type": "java.lang.Boolean", "description": "Enables the use of the Apache HTTP Client 5 by Feign.", - "defaultValue": "false" + "defaultValue": "true" }, { "name": "spring.cloud.openfeign.okhttp.enabled",