Skip to content

修复 wx-java-open-multi-spring-boot-starter 硬编码 HttpClient4 导致启动失败的问题#4060

Draft
Copilot wants to merge 2 commits into
developfrom
copilot/fix-httpclient-dependency-issue
Draft

修复 wx-java-open-multi-spring-boot-starter 硬编码 HttpClient4 导致启动失败的问题#4060
Copilot wants to merge 2 commits into
developfrom
copilot/fix-httpclient-dependency-issue

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

AbstractWxOpenConfiguration.configHttp() 无条件实例化 DefaultApacheHttpClientBuilder(HttpClient 4.x),而默认服务实现 WxOpenServiceImpl 实际使用 HttpClient 5.x,导致未显式引入 HttpClient4 依赖的项目启动时抛出 NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager

变更内容

  • WxOpenMultiProperties:新增 HttpClientType 枚举(APACHE_HTTP / HTTP_COMPONENTS),并在 ConfigStorage 中添加 httpClientType 字段,默认值为 HTTP_COMPONENTS

  • AbstractWxOpenConfiguration

    • wxOpenService() 根据 httpClientType 动态选择 WxOpenServiceApacheHttpClientImplWxOpenServiceHttpComponentsImpl
    • configHttp() 仅在 httpClientType == APACHE_HTTP 时才配置 DefaultApacheHttpClientBuilder

默认行为与原来一致(HttpClient 5.x),无需修改现有配置。如需切换至 HttpClient 4.x:

wx:
  open:
    config-storage:
      http-client-type: APACHE_HTTP

- 在 WxOpenMultiProperties.ConfigStorage 中新增 HttpClientType 枚举(APACHE_HTTP / HTTP_COMPONENTS)及 httpClientType 字段,默认值为 HTTP_COMPONENTS
- 修改 AbstractWxOpenConfiguration.wxOpenService() 根据 httpClientType 选择对应的 WxOpenServiceApacheHttpClientImpl 或 WxOpenServiceHttpComponentsImpl
- 修改 AbstractWxOpenConfiguration.configHttp() 仅在 httpClientType 为 APACHE_HTTP 时配置 DefaultApacheHttpClientBuilder,消除对 HttpClient4 的强制依赖

Closes #4059
Copilot AI changed the title [WIP] Fix HttpClient version dependency issue in wx-java-open-multi-spring-boot-starter 修复 wx-java-open-multi-spring-boot-starter 硬编码 HttpClient4 导致启动失败的问题 Jul 1, 2026
Copilot AI requested a review from binarywang July 1, 2026 02:00
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.

wx-java-open-multi-spring-boot-starter HttpClient 版本依赖问题

2 participants