Skip to content

OkHttp startup does not take effect #1309

Description

@xingjian

我现在使用的框架的版本信息如下:
The 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

org.springframework.cloud spring-cloud-starter-openfeign org.springframework.cloud spring-cloud-starter-loadbalancer io.github.openfeign feign-okhttp

配置如下:
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?

Activity

  1. xingjian commented on Jan 12, 2026

    @xingjian
    Author
    Image
  2. MichelKlein89 commented on Jan 20, 2026

    @MichelKlein89

    I have the same issue. The property spring.cloud.openfeign.okhttp.enabled seems 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?

  3. MichelKlein89 commented on Jan 20, 2026

    @MichelKlein89

    As 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

  4. xingjian commented on Jan 21, 2026

    @xingjian
    Author

    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.

  5. MKorsch commented on Feb 11, 2026

    @MKorsch

    I’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).

  6. gamelike commented on May 15, 2026

    @gamelike

    I'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?

  7. Areiser commented on Jun 23, 2026

    @Areiser

    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 anywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions