Skip to content

Commit cd4317a

Browse files
authored
🎨 #3384 【公众号】为 starter 添加 HttpComponents (httpclient5) 支持
1 parent 0851259 commit cd4317a

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
<artifactId>okhttp</artifactId>
4545
<scope>provided</scope>
4646
</dependency>
47+
<dependency>
48+
<groupId>org.apache.httpcomponents.client5</groupId>
49+
<artifactId>httpclient5</artifactId>
50+
<scope>provided</scope>
51+
</dependency>
4752
</dependencies>
4853

4954
<build>

spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
<artifactId>okhttp</artifactId>
4040
<scope>provided</scope>
4141
</dependency>
42+
<dependency>
43+
<groupId>org.apache.httpcomponents.client5</groupId>
44+
<artifactId>httpclient5</artifactId>
45+
<scope>provided</scope>
46+
</dependency>
4247
</dependencies>
4348

4449
<build>

spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/config/WxMpServiceAutoConfiguration.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
55
import me.chanjar.weixin.mp.api.WxMpService;
66
import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl;
7+
import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpComponentsImpl;
78
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
89
import me.chanjar.weixin.mp.api.impl.WxMpServiceJoddHttpImpl;
910
import me.chanjar.weixin.mp.api.impl.WxMpServiceOkHttpImpl;
@@ -35,6 +36,9 @@ public WxMpService wxMpService(WxMpConfigStorage configStorage, WxMpProperties w
3536
case HttpClient:
3637
wxMpService = newWxMpServiceHttpClientImpl();
3738
break;
39+
case HttpComponents:
40+
wxMpService = newWxMpServiceHttpComponentsImpl();
41+
break;
3842
default:
3943
wxMpService = newWxMpServiceImpl();
4044
break;
@@ -60,4 +64,8 @@ private WxMpService newWxMpServiceJoddHttpImpl() {
6064
return new WxMpServiceJoddHttpImpl();
6165
}
6266

67+
private WxMpService newWxMpServiceHttpComponentsImpl() {
68+
return new WxMpServiceHttpComponentsImpl();
69+
}
70+
6371
}

spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/enums/HttpClientType.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ public enum HttpClientType {
1919
* JoddHttp.
2020
*/
2121
JoddHttp,
22+
/**
23+
* HttpComponents (Apache HttpClient 5.x).
24+
*/
25+
HttpComponents,
2226
}

0 commit comments

Comments
 (0)