🎨 #3824 【基础架构】升级到 Apache HttpClient 5.x 作为默认 HTTP 客户端
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ package com.binarywang.spring.starter.wxjava.channel.enums;
|
||||
*/
|
||||
public enum HttpClientType {
|
||||
/**
|
||||
* HttpClient
|
||||
* HttpClient.
|
||||
*/
|
||||
HttpClient
|
||||
HttpClient,
|
||||
/**
|
||||
* HttpComponents.
|
||||
*/
|
||||
HttpComponents,
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class WxChannelProperties {
|
||||
/**
|
||||
* http客户端类型
|
||||
*/
|
||||
private HttpClientType httpClientType = HttpClientType.HttpClient;
|
||||
private HttpClientType httpClientType = HttpClientType.HttpComponents;
|
||||
|
||||
/**
|
||||
* http代理主机
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -80,7 +80,7 @@ public class WxMpProperties {
|
||||
/**
|
||||
* http客户端类型.
|
||||
*/
|
||||
private HttpClientType httpClientType = HttpClientType.HttpClient;
|
||||
private HttpClientType httpClientType = HttpClientType.HttpComponents;
|
||||
|
||||
/**
|
||||
* http代理主机.
|
||||
|
||||
@@ -19,4 +19,8 @@ public enum HttpClientType {
|
||||
* JoddHttp.
|
||||
*/
|
||||
JoddHttp,
|
||||
/**
|
||||
* HttpComponents.
|
||||
*/
|
||||
HttpComponents,
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class WxQidianProperties {
|
||||
/**
|
||||
* http客户端类型.
|
||||
*/
|
||||
private HttpClientType httpClientType = HttpClientType.HttpClient;
|
||||
private HttpClientType httpClientType = HttpClientType.HttpComponents;
|
||||
|
||||
/**
|
||||
* http代理主机.
|
||||
|
||||
Reference in New Issue
Block a user