1
0
mirror of synced 2026-02-07 19:27:50 +08:00

🎨 #3824 【基础架构】升级到 Apache HttpClient 5.x 作为默认 HTTP 客户端

This commit is contained in:
Copilot
2026-01-06 11:20:58 +08:00
committed by GitHub
parent 987001214d
commit e46da01cc8
20 changed files with 313 additions and 24 deletions

View File

@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceHttpClientImpl;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceHttpComponentsImpl;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceImpl;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
@@ -84,6 +85,9 @@ public abstract class AbstractWxChannelConfiguration {
case HTTP_CLIENT:
wxChannelService = new WxChannelServiceHttpClientImpl();
break;
case HTTP_COMPONENTS:
wxChannelService = new WxChannelServiceHttpComponentsImpl();
break;
default:
wxChannelService = new WxChannelServiceImpl();
break;

View File

@@ -8,7 +8,7 @@ package com.binarywang.spring.starter.wxjava.channel.enums;
*/
public enum HttpClientType {
/**
* HttpClient
* HttpClient.
*/
HTTP_CLIENT,
// WxChannelServiceOkHttpImpl 实现经测试无法正常完成业务固暂不支持OK_HTTP方式
@@ -16,4 +16,8 @@ public enum HttpClientType {
// * OkHttp.
// */
// OK_HTTP,
/**
* HttpComponents.
*/
HTTP_COMPONENTS,
}

View File

@@ -7,7 +7,11 @@ package com.binarywang.spring.starter.wxjava.channel.enums;
*/
public enum HttpClientType {
/**
* HttpClient
* HttpClient.
*/
HttpClient
HttpClient,
/**
* HttpComponents.
*/
HttpComponents,
}

View File

@@ -85,7 +85,7 @@ public class WxChannelProperties {
/**
* http客户端类型
*/
private HttpClientType httpClientType = HttpClientType.HttpClient;
private HttpClientType httpClientType = HttpClientType.HttpComponents;
/**
* http代理主机

View File

@@ -8,7 +8,7 @@ package com.binarywang.spring.starter.wxjava.miniapp.enums;
*/
public enum HttpClientType {
/**
* HttpClient.
* HttpClient (Apache HttpClient 4.x).
*/
HttpClient,
/**
@@ -19,4 +19,8 @@ public enum HttpClientType {
* JoddHttp.
*/
JoddHttp,
/**
* HttpComponents (Apache HttpClient 5.x).
*/
HttpComponents,
}

View File

@@ -27,7 +27,7 @@
#wx.mp.config-storage.redis.sentinel-ips=127.0.0.1:16379,127.0.0.1:26379
#wx.mp.config-storage.redis.sentinel-name=mymaster
# http客户端配置
wx.mp.config-storage.http-client-type=httpclient # http客户端类型: HttpClient(默认), OkHttp, JoddHttp
wx.mp.config-storage.http-client-type=HttpComponents # http客户端类型: HttpComponents(Apache HttpClient 5.x推荐), HttpClient(Apache HttpClient 4.x), OkHttp, JoddHttp
wx.mp.config-storage.http-proxy-host=
wx.mp.config-storage.http-proxy-port=
wx.mp.config-storage.http-proxy-username=

View File

@@ -80,7 +80,7 @@ public class WxMpProperties {
/**
* http客户端类型.
*/
private HttpClientType httpClientType = HttpClientType.HttpClient;
private HttpClientType httpClientType = HttpClientType.HttpComponents;
/**
* http代理主机.

View File

@@ -19,4 +19,8 @@ public enum HttpClientType {
* JoddHttp.
*/
JoddHttp,
/**
* HttpComponents.
*/
HttpComponents,
}

View File

@@ -72,7 +72,7 @@ public class WxQidianProperties {
/**
* http客户端类型.
*/
private HttpClientType httpClientType = HttpClientType.HttpClient;
private HttpClientType httpClientType = HttpClientType.HttpComponents;
/**
* http代理主机.