Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

Apache HttpClient 4.x 已进入维护模式。项目已有完整的 HttpClient 5.x 实现(hc/ 目录),但配置为 provided scope。本 PR 将 HttpClient 5.x 设为默认,同时保持 4.x 兼容。

依赖变更

  • 添加 httpclient5.version=5.5 属性
  • httpclient5provided 改为默认依赖
  • 保留 httpclient 4.5.13 作为默认依赖(向后兼容)
  • 两个版本共存,通过配置选择

默认配置

对已有 *HttpComponentsImpl 实现的模块,将默认 HTTP 客户端改为 HttpComponents (5.x):

  • ✅ weixin-java-mp, cp, channel, qidian, pay, open → 默认 HttpComponents
  • ⚠️ weixin-java-miniapp → 保持 HttpClient (4.x),暂无 5.x 实现

更新所有 HttpClientType 枚举添加 HttpComponents 选项。

配置示例

# Spring Boot 配置
wx.mp.config-storage.http-client-type=HttpComponents  # 5.x (新默认)
wx.mp.config-storage.http-client-type=HttpClient      # 4.x (兼容)
wx.mp.config-storage.http-client-type=OkHttp          # 可选
wx.mp.config-storage.http-client-type=JoddHttp        # 可选
// 纯 Java 配置
WxMpService service = new WxMpServiceHttpComponentsImpl();  // 5.x
WxMpService service = new WxMpServiceHttpClientImpl();      // 4.x

文档

  • README.md: HTTP 客户端支持说明和配置表格
  • docs/HTTPCLIENT_UPGRADE_GUIDE.md: 详细迁移指南
  • Spring Boot Starter README: 更新配置示例

兼容性

  • 现有项目无需修改代码
  • HttpClient 4.x 代码和依赖保持不变
  • 用户可通过配置自由切换客户端类型
Original prompt

This section details on the original issue you should resolve

<issue_title>请问什么时候升级Httpclient,或者换成其他库,现在Httpclient4.x已经改成Httpclient5.x了</issue_title>
<issue_description>请问什么时候升级Httpclient,或者换成其他库,现在Httpclient4.x已经改成Httpclient5.x了
</issue_description>

Comments on the Issue (you are @copilot in this section)

@binarywang 这可能是个大工程,欢迎提供PR代码来实现

Custom agent used: 全部用中文
需要用中文,包括PR标题和分析总结过程


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Upgrade HttpClient from version 4.x to 5.x 升级到 Apache HttpClient 5.x 作为默认 HTTP 客户端 Dec 24, 2025
Copilot AI requested a review from binarywang December 24, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

请问什么时候升级Httpclient,或者换成其他库,现在Httpclient4.x已经改成Httpclient5.x了

2 participants