为 wx-java-mp-spring-boot-starter 添加 HttpComponents (httpclient5) 支持#3782
Merged
binarywang merged 3 commits intodevelopfrom Dec 4, 2025
Merged
为 wx-java-mp-spring-boot-starter 添加 HttpComponents (httpclient5) 支持#3782binarywang merged 3 commits intodevelopfrom
binarywang merged 3 commits intodevelopfrom
Conversation
…兼容 Spring Boot 3 Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for Spring Boot 3 in wx-java-mp-starter
为 wx-java-mp-spring-boot-starter 添加 HttpComponents (httpclient5) 支持
Nov 28, 2025
Owner
|
@copilot WxMpServiceHttpComponentsImpl 这个类是存在的吗?你是不是得先实现这个类 |
Contributor
Author
There was a problem hiding this comment.
Pull request overview
本 PR 为 wx-java-mp-spring-boot-starter 和 wx-java-mp-multi-spring-boot-starter 添加了对 Apache HttpClient 5.x(HttpComponents)的支持,解决 Spring Boot 3 升级时因强制使用 httpclient5 而导致的兼容性问题。核心库 weixin-java-mp 已提供 WxMpServiceHttpComponentsImpl 实现,本次修改将该选项暴露给 Spring Boot starter 用户使用。
关键变更:
- 在
HttpClientType枚举中新增HttpComponents值 - 在自动配置类中添加对应的实例化逻辑
- 在 pom.xml 中添加 httpclient5 依赖(scope: provided)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/enums/HttpClientType.java | 为 HttpClientType 枚举添加 HttpComponents 值,用于标识 Apache HttpClient 5.x 实现 |
| spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/config/WxMpServiceAutoConfiguration.java | 在自动配置类的 switch 语句中添加 HttpComponents case 分支,并实现相应的工厂方法 |
| spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml | 添加 httpclient5 依赖(scope: provided),与其他 HTTP 客户端依赖保持一致 |
| spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml | 为多账号版本 starter 添加 httpclient5 依赖(代码逻辑已支持 HTTP_COMPONENTS,仅补充依赖声明) |
Comment on lines
+42
to
+46
| <dependency> | ||
| <groupId>org.apache.httpcomponents.client5</groupId> | ||
| <artifactId>httpclient5</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> |
There was a problem hiding this comment.
README.md 中的文档需要更新,以包含新的 HttpComponents 选项。
当前第 30 行显示:
wx.mp.config-storage.http-client-type=httpclient # http客户端类型: HttpClient(默认), OkHttp, JoddHttp建议更新为:
wx.mp.config-storage.http-client-type=httpclient # http客户端类型: HttpClient(默认), OkHttp, JoddHttp, HttpComponents注意:HttpComponents 对应 Apache HttpClient 5.x,适用于 Spring Boot 3 环境。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spring Boot 3 强制使用 httpclient5,而当前 starter 仅支持 httpclient4,导致升级后无法运行。核心库已有
WxMpServiceHttpComponentsImpl实现,本 PR 为 starter 暴露该选项。修改内容
wx-java-mp-spring-boot-starter
HttpClientType枚举添加HttpComponents值WxMpServiceAutoConfiguration添加对应 case 分支pom.xml添加 httpclient5 依赖 (scope: provided)wx-java-mp-multi-spring-boot-starter
pom.xml添加 httpclient5 依赖(代码已支持HTTP_COMPONENTS)使用方法
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.