Repository navigation
OkHttp startup does not take effect #1309
Description
Activity
I have the same issue. The property
spring.cloud.openfeign.okhttp.enabledseems not to exist anymore. We used to configure the okhttp client, because we have to perform PATCH request. Is there any other way to support it?Reacted by AreiserAs a workaround, I am using Apache HTTP Client 5
<dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-hc5</artifactId> </dependency>As soon as this library is in the class path, spring auto configure the usage of the Apache HTTP Client. This works for me to perform PATCH requests
Thank you. I have also found that the configuration item spring.cloud.openfeign.okhttp.enabled has been removed in the latest version. The official recommendation is to use Apache HttpClient 5 (hc5). If you have to use OkHttp, you have to implement the configuration manually. However, I have now changed my mind and decided to follow the official suggestion.
Reacted by Michèl KleinI’m hitting the same issue. Migrating to Apache HttpClient is unfortunately not straightforward in my case.
The official recommendation is to use Apache HttpClient 5 (hc5).
@xingjian Could you point me to where this recommendation is documented? I couldn’t find an official source (docs / issue / migration guide).
Reacted by AreiserI'm hitting the same issue. I cloudn't find this description in this (changelog, docs) document.
The official recommendation is to use Apache HttpClient 5 (hc5). If you have to use OkHttp, you have to implement the configuration manually. However, I have now changed my mind and decided to follow the official suggestion.
@xingjian Could you provide me with a link to view the relevant migration docs?
Why does https://docs.spring.io/spring-cloud-openfeign/docs/current/reference/html/#spring-cloud-feign-overriding-defaults still say that
To use OkHttpClient-backed Feign clients, make sure OKHttpClient is on your classpath and set spring.cloud.openfeign.okhttp.enabled to true.🙈 we also hit this problem as it was not documented anywhereReacted by Joe

我现在使用的框架的版本信息如下:
org.springframework.cloud spring-cloud-starter-openfeign org.springframework.cloud spring-cloud-starter-loadbalancer io.github.openfeign feign-okhttpThe version information of the framework I am currently using is as follows:
spring boot 4.0.1,
spring cloud 2025.1.0,
spring-cloud-alibaba 2025.1.0.0-SNAPSHOT,
feign-okhttp 13.6,
spring-cloud-starter-loadbalancer 5.0.0,
spring-cloud-starter-openfeign 5.0.0
现在计划采用okhttp连接池,我已经引入相关包及配置,如下:
We are now planning to adopt the OkHttp connection pool, and I have imported the relevant packages and configurations as follows:
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-discovery
配置如下:
Configurations below:
feign:
okhttp:
enabled: true
httpclient:
enabled: false
发现有如下问题:
启动okhttp不生效。请问如何配置及查找问题原因?
The following issues have been identified:
The OkHttp startup does not take effect. Could you please advise on how to configure it and troubleshoot the root cause of the issue?