Skip to content

Commit 7bd4726

Browse files
authored
Merge pull request binarywang#1419 from Wechat-Group/develop
合并Develop分支代码,发布3.7.0正式版
2 parents 13a3f58 + 1b66e77 commit 7bd4726

File tree

243 files changed

+9337
-991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+9337
-991
lines changed

pom.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.github.binarywang</groupId>
88
<artifactId>wx-java</artifactId>
9-
<version>3.6.0</version>
9+
<version>3.7.0</version>
1010
<packaging>pom</packaging>
1111
<name>WxJava - Weixin/Wechat Java SDK</name>
1212
<description>微信开发Java SDK</description>
@@ -99,6 +99,7 @@
9999
</scm>
100100

101101
<modules>
102+
<module>weixin-graal</module>
102103
<module>weixin-java-common</module>
103104
<module>weixin-java-cp</module>
104105
<module>weixin-java-mp</module>
@@ -172,7 +173,7 @@
172173
<dependency>
173174
<groupId>com.thoughtworks.xstream</groupId>
174175
<artifactId>xstream</artifactId>
175-
<version>1.4.11</version>
176+
<version>1.4.11.1</version>
176177
</dependency>
177178
<!-- 由于guava较新的21.0版本需要jdk8,故而此处采用较低版本 -->
178179
<dependency>
@@ -242,6 +243,12 @@
242243
<version>2.9.0</version>
243244
<scope>provided</scope>
244245
</dependency>
246+
<dependency>
247+
<groupId>org.redisson</groupId>
248+
<artifactId>redisson</artifactId>
249+
<version>3.12.0</version>
250+
<scope>provided</scope>
251+
</dependency>
245252
<dependency>
246253
<groupId>org.projectlombok</groupId>
247254
<artifactId>lombok</artifactId>
@@ -325,6 +332,14 @@
325332
</plugins>
326333
</build>
327334
</profile>
335+
336+
<profile>
337+
<id>native-image</id>
338+
<activation>
339+
<activeByDefault>false</activeByDefault>
340+
</activation>
341+
</profile>
342+
328343
</profiles>
329344

330345
<build>

spring-boot-starters/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.github.binarywang</groupId>
88
<artifactId>wx-java</artifactId>
9-
<version>3.6.0</version>
9+
<version>3.7.0</version>
1010
</parent>
1111
<packaging>pom</packaging>
1212
<artifactId>wx-java-spring-boot-starters</artifactId>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>wx-java-spring-boot-starters</artifactId>
77
<groupId>com.github.binarywang</groupId>
8-
<version>3.6.0</version>
8+
<version>3.7.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>wx-java-spring-boot-starters</artifactId>
77
<groupId>com.github.binarywang</groupId>
8-
<version>3.6.0</version>
8+
<version>3.7.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -24,6 +24,11 @@
2424
<artifactId>jedis</artifactId>
2525
<scope>compile</scope>
2626
</dependency>
27+
<dependency>
28+
<groupId>org.redisson</groupId>
29+
<artifactId>redisson</artifactId>
30+
<scope>compile</scope>
31+
</dependency>
2732
</dependencies>
2833

2934
<build>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
77
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
88
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
9+
import org.redisson.api.RedissonClient;
910
import org.springframework.beans.factory.annotation.Autowired;
1011
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
1112
import org.springframework.context.annotation.Bean;
@@ -26,6 +27,9 @@ public class WxMpStorageAutoConfiguration {
2627
@Autowired(required = false)
2728
private JedisPool jedisPool;
2829

30+
@Autowired(required = false)
31+
private RedissonClient redissonClient;
32+
2933
@Bean
3034
@ConditionalOnMissingBean(WxMpConfigStorage.class)
3135
public WxMpConfigStorage wxMpInMemoryConfigStorage() {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>wx-java-spring-boot-starters</artifactId>
77
<groupId>com.github.binarywang</groupId>
8-
<version>3.6.0</version>
8+
<version>3.7.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -24,6 +24,11 @@
2424
<artifactId>jedis</artifactId>
2525
<scope>compile</scope>
2626
</dependency>
27+
<dependency>
28+
<groupId>org.redisson</groupId>
29+
<artifactId>redisson</artifactId>
30+
<scope>compile</scope>
31+
</dependency>
2732
</dependencies>
2833

2934
<build>

spring-boot-starters/wx-java-open-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/open/config/WxOpenStorageAutoConfiguration.java

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
77
import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage;
88
import me.chanjar.weixin.open.api.impl.WxOpenInRedisConfigStorage;
9+
import me.chanjar.weixin.open.api.impl.WxOpenInRedissonConfigStorage;
910
import org.apache.commons.lang3.StringUtils;
11+
import org.redisson.Redisson;
12+
import org.redisson.api.RedissonClient;
13+
import org.redisson.config.Config;
14+
import org.redisson.config.TransportMode;
1015
import org.springframework.beans.factory.annotation.Autowired;
1116
import org.springframework.beans.factory.annotation.Value;
1217
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -28,6 +33,9 @@ public class WxOpenStorageAutoConfiguration {
2833
@Autowired(required = false)
2934
private JedisPool jedisPool;
3035

36+
@Autowired(required = false)
37+
private RedissonClient redissonClient;
38+
3139
@Value("${wx.open.config-storage.redis.host:}")
3240
private String redisHost;
3341

@@ -40,12 +48,20 @@ public WxOpenConfigStorage wxOpenConfigStorage() {
4048
if (type == WxOpenProperties.StorageType.redis) {
4149
return getWxOpenInRedisConfigStorage();
4250
}
51+
52+
if (type == WxOpenProperties.StorageType.jedis) {
53+
return getWxOpenInRedisConfigStorage();
54+
}
55+
56+
if (type == WxOpenProperties.StorageType.redisson) {
57+
return getWxOpenInRedissonConfigStorage();
58+
}
4359
return getWxOpenInMemoryConfigStorage();
4460
}
4561

4662
private WxOpenInMemoryConfigStorage getWxOpenInMemoryConfigStorage() {
4763
WxOpenInMemoryConfigStorage config = new WxOpenInMemoryConfigStorage();
48-
setWxOpenInfo(config);
64+
config.setWxOpenInfo(properties.getAppId(), properties.getSecret(), properties.getToken(), properties.getAesKey());
4965
return config;
5066
}
5167

@@ -54,18 +70,22 @@ private WxOpenInRedisConfigStorage getWxOpenInRedisConfigStorage() {
5470
if (jedisPool == null || StringUtils.isNotEmpty(redisHost)) {
5571
poolToUse = getJedisPool();
5672
}
57-
WxOpenInRedisConfigStorage config = new WxOpenInRedisConfigStorage(poolToUse);
58-
setWxOpenInfo(config);
73+
WxOpenInRedisConfigStorage config = new WxOpenInRedisConfigStorage(poolToUse, properties.getConfigStorage().getKeyPrefix());
74+
config.setWxOpenInfo(properties.getAppId(), properties.getSecret(), properties.getToken(), properties.getAesKey());
5975
return config;
6076
}
6177

62-
private void setWxOpenInfo(WxOpenConfigStorage config) {
63-
config.setComponentAppId(properties.getAppId());
64-
config.setComponentAppSecret(properties.getSecret());
65-
config.setComponentToken(properties.getToken());
66-
config.setComponentAesKey(properties.getAesKey());
78+
private WxOpenInRedissonConfigStorage getWxOpenInRedissonConfigStorage() {
79+
RedissonClient redissonClientToUse = this.redissonClient;
80+
if (redissonClient == null) {
81+
redissonClientToUse = getRedissonClient();
82+
}
83+
WxOpenInRedissonConfigStorage config = new WxOpenInRedissonConfigStorage(redissonClientToUse, properties.getConfigStorage().getKeyPrefix());
84+
config.setWxOpenInfo(properties.getAppId(), properties.getSecret(), properties.getToken(), properties.getAesKey());
85+
return config;
6786
}
6887

88+
6989
private JedisPool getJedisPool() {
7090
WxOpenProperties.ConfigStorage storage = properties.getConfigStorage();
7191
RedisProperties redis = storage.getRedis();
@@ -90,4 +110,16 @@ private JedisPool getJedisPool() {
90110
redis.getTimeout(), redis.getPassword(), redis.getDatabase());
91111
return pool;
92112
}
113+
114+
private RedissonClient getRedissonClient() {
115+
WxOpenProperties.ConfigStorage storage = properties.getConfigStorage();
116+
RedisProperties redis = storage.getRedis();
117+
118+
Config config = new Config();
119+
config.useSingleServer()
120+
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
121+
.setPassword(redis.getPassword());
122+
config.setTransportMode(TransportMode.NIO);
123+
return Redisson.create(config);
124+
}
93125
}

spring-boot-starters/wx-java-open-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/open/properties/WxOpenProperties.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public static class ConfigStorage implements Serializable {
5353

5454
private RedisProperties redis = new RedisProperties();
5555

56+
private String keyPrefix;
57+
5658
}
5759

5860
public enum StorageType {
@@ -63,6 +65,14 @@ public enum StorageType {
6365
/**
6466
* redis.
6567
*/
66-
redis
68+
redis,
69+
/**
70+
* jedis.
71+
*/
72+
jedis,
73+
/**
74+
* redisson.
75+
*/
76+
redisson
6777
}
6878
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>wx-java-spring-boot-starters</artifactId>
77
<groupId>com.github.binarywang</groupId>
8-
<version>3.6.0</version>
8+
<version>3.7.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

weixin-graal/pom.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.github.binarywang</groupId>
8+
<artifactId>wx-java</artifactId>
9+
<version>3.7.0</version>
10+
</parent>
11+
12+
<artifactId>weixin-graal</artifactId>
13+
<name>WxJava - Graal</name>
14+
<description>微信开发Java内部配合graal以产生native-image配置的辅助工具, 可以通过项目的 native-image Profile 来启用: mvn -P native-image ...
15+
</description>
16+
17+
<dependencies>
18+
19+
<dependency>
20+
<groupId>org.projectlombok</groupId>
21+
<artifactId>lombok</artifactId>
22+
<scope>compile</scope>
23+
</dependency>
24+
25+
</dependencies>
26+
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>org.apache.maven.plugins</groupId>
31+
<artifactId>maven-compiler-plugin</artifactId>
32+
<version>3.5.1</version>
33+
<configuration>
34+
<proc>none</proc>
35+
</configuration>
36+
</plugin>
37+
</plugins>
38+
</build>
39+
40+
</project>

0 commit comments

Comments
 (0)