1
0
mirror of synced 2025-12-19 06:37:59 +08:00

🎨 #3384 【公众号】为 starter 添加 HttpComponents (httpclient5) 支持

This commit is contained in:
Copilot
2025-12-04 19:38:10 +08:00
committed by GitHub
parent 085125960b
commit cd4317ab3e
4 changed files with 22 additions and 0 deletions

View File

@@ -44,6 +44,11 @@
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -39,6 +39,11 @@
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -4,6 +4,7 @@ import com.binarywang.spring.starter.wxjava.mp.enums.HttpClientType;
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties; import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpComponentsImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceJoddHttpImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceJoddHttpImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceOkHttpImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceOkHttpImpl;
@@ -35,6 +36,9 @@ public class WxMpServiceAutoConfiguration {
case HttpClient: case HttpClient:
wxMpService = newWxMpServiceHttpClientImpl(); wxMpService = newWxMpServiceHttpClientImpl();
break; break;
case HttpComponents:
wxMpService = newWxMpServiceHttpComponentsImpl();
break;
default: default:
wxMpService = newWxMpServiceImpl(); wxMpService = newWxMpServiceImpl();
break; break;
@@ -60,4 +64,8 @@ public class WxMpServiceAutoConfiguration {
return new WxMpServiceJoddHttpImpl(); return new WxMpServiceJoddHttpImpl();
} }
private WxMpService newWxMpServiceHttpComponentsImpl() {
return new WxMpServiceHttpComponentsImpl();
}
} }

View File

@@ -19,4 +19,8 @@ public enum HttpClientType {
* JoddHttp. * JoddHttp.
*/ */
JoddHttp, JoddHttp,
/**
* HttpComponents (Apache HttpClient 5.x).
*/
HttpComponents,
} }