Skip to content

合并Develop分支,发布正式版本 #1577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 119 commits into from
May 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
0a8db29
Merge branch 'master' into develop
binarywang Feb 29, 2020
e3c6aff
Merge branch 'master' into develop
binarywang Feb 29, 2020
0a99706
:bug: #1426 修复多公众号管理的两个问题
silloy Mar 8, 2020
1b193e3
:bug: #1420 修复小程序云开发获取文件下载链接接口
binarywang Mar 8, 2020
06aaacc
:art: 优化点代码
binarywang Mar 8, 2020
f58ba62
:art: #1428 微信支付统一下单接口中的attach和detail参数在生成xml时加入CDATA标签
binarywang Mar 8, 2020
fb47052
:art: 优化代码,增加serialVersionUID
binarywang Mar 8, 2020
8aa4758
:bug: #1425 修复企业微信OA审批相关几个参数的类型或命名
binarywang Mar 8, 2020
c8a23b8
:bookmark: 发布 3.7.1.B 测试版本
binarywang Mar 8, 2020
9b32271
:bug: 修复yml没有redis的配置提示
miemieYaho Mar 11, 2020
341f176
:bug: #1438 修复模板消息行业设置类无法解析类似"互联网|电子商务"形式数据的问题
Jc826 Mar 12, 2020
e761174
:art: #1437 公众号spring boot starter模块优化,不强制依赖redission
miemieYaho Mar 12, 2020
704a389
:art: #1432 企业微信部门类增加英文名称属性
binarywang Mar 12, 2020
2406dc6
:art: #1435 微信支付查询结果类增加几个缺失的参数
binarywang Mar 12, 2020
c184ae1
:art: 文档地址修复
binarywang Mar 12, 2020
07a1d26
:art: #1430 WxMpConfigStorageHolder提供remove方法,方便使用者调用
binarywang Mar 12, 2020
61d9fe4
:art: #1411 小程序模块消息路由增加消息排重机制
binarywang Mar 12, 2020
ec8cc3b
:bookmark: 发布 3.7.2.B 测试版本
binarywang Mar 15, 2020
ea01e55
:new: #1396 增加企业微信外部联系人相关接口实现
yuanqixun Mar 16, 2020
868545c
:art: #1449 微信卡券信息增加审核状态字段
silloy Mar 19, 2020
6f7bc7c
:art: #1450 企业微信优化获取三方授权码的接口实现
yuanqixun Mar 19, 2020
d3b58e3
:art: #1458 微信支付createOrder方法增加一个重载实现
xJoeWoo Mar 22, 2020
5b934c0
:art: #1457 企业微信OA审批相关类优化,增加缺失的@Data注解
hrwhat Mar 22, 2020
83d1b93
:bug: #1445 付款码支付请求参数里的receipt修改为非必传
binarywang Mar 22, 2020
8d6978d
:art: #1456 企业微信通讯录成员属性相关代码根据最新接口文档进行同步完善,并增加几个新的属性
binarywang Mar 22, 2020
38959f8
:bug: #1455 修复微信支付分账结果查询接口的分账接收人解析错误的问题,并补充相关单元测试代码
binarywang Mar 22, 2020
b9f60cd
:art: #1452 微信支付付款码支付请求类的storeMap方法增加保存分账字段
binarywang Mar 22, 2020
ffb25e9
:art: #1443 微信支付createOrder接口返回对象的几个封装实现类增加无参构造方法
binarywang Mar 22, 2020
71d6d7f
:art: #1441 修复刷脸支付获取AuthInfo接口字段顺序问题
binarywang Mar 22, 2020
2cda0e4
:art: 增加构造方法
binarywang Mar 22, 2020
c15384f
:bookmark: 发布 3.7.3.B 测试版本
binarywang Mar 22, 2020
bb12cce
:art: 优化代码,增加单元测试
binarywang Mar 23, 2020
0397e44
Merge branch 'master' into develop
binarywang Mar 25, 2020
60c37d8
:art: #1472 补充微信支付模块部分Result类在XML快速模式转换下缺失的字段
1ibo Mar 26, 2020
f65833f
:art: 小程序模块WxMaPhoneNumberInfo里的内部类Watermark实现序列化接口
binarywang Mar 26, 2020
faf07b3
:bug: 修复微信支付分账查询接口返回结果类里的分帐单号字段错误的问题
binarywang Mar 26, 2020
9bad0ff
:bug: #1473 修复多个小程序获取redis里的access_token冲突问题
binarywang Mar 26, 2020
7a1863b
:art: #1476 小程序云开发优化数据库CRUD操作的相关接口方法
Mar 28, 2020
8c15b3b
:art: #1475 公众号模块增加微信卡券和统计接口的一些缺失字段和枚举类
silloy Mar 28, 2020
ef6e2dd
:art: 优化完善部分接口javadoc
binarywang Mar 28, 2020
a45a982
#1462 优化刷脸支付获取微信刷脸支付凭证的接口,保证请求到微信端时signType有值
binarywang Mar 28, 2020
73ecaab
:bug: #1463 修复微信支付查询分账结果请求签名问题,subAppId不参与签名
binarywang Mar 28, 2020
1f49ac0
:art: 优化代码,去掉之前PR引入的lambda表达式,保证兼容java7
binarywang Mar 28, 2020
a9cd7d2
:art: #1427 fix XmlUtils.xml2Map() method which was vulnerable to XXE…
binarywang Mar 28, 2020
3048767
:bookmark: 发布 3.7.4.B 测试版本
binarywang Mar 29, 2020
8f2c641
Merge branch 'master' into develop
binarywang Mar 29, 2020
96b370e
:new: #1373 增加小程序自定义模板的支持:主要是导入抽样数据接口的实现,以及接收消息时对相关属性的支持
binarywang Mar 29, 2020
fb3ed0b
:art: #1485 小程序部分请求类增加无参构造方法
binarywang Apr 4, 2020
61e6221
:art: #1483 微信支付异步通知解析时使用通知里的签名类型进行验签
binarywang Apr 4, 2020
7f6780a
:art: #1482 小程序接口请求出错超过重试次数时将微信原始错误信息抛出来
binarywang Apr 4, 2020
2cd362d
:art: 优化更新部分注释
binarywang Apr 4, 2020
1a8ec43
:bug: #1424 修复开放平台execute方法加同步锁导致的并发性能问题
007gzs Apr 4, 2020
a05b2ce
:art: add serialVersionUID for some class
binarywang Apr 4, 2020
d703f2d
:bookmark: 发布 3.7.5.B 测试版本
binarywang Apr 4, 2020
04f7d76
:art: #1487 开放平台模块三方平台获取token方法支持redis分布式锁
007gzs Apr 4, 2020
d752c48
:art: #1488 公众号模块支持分布式锁,设置token过期时加锁
007gzs Apr 4, 2020
c175a31
:bug: 修复代码
binarywang Apr 4, 2020
458c645
:art: 格式化部分代码
binarywang Apr 4, 2020
a976696
:new: #1429 增加小程序直播类相关接口
yjwang3300300 Apr 5, 2020
6633ea3
:art: #1496 更改卡券接口的门店位置ID字段的类型
silloy Apr 9, 2020
4a88064
:fix: #1499 增加企业微信oa审批信息的消息内容
Gyv12345 Apr 11, 2020
1487ce3
:bookmark: 发布 3.7.6.B 测试版本
binarywang Apr 11, 2020
3af0a2b
:art: #1497 微信公众号群发图文消息接口参数优化,保持跟普通发送接口一致,减少重复代码
binarywang Apr 12, 2020
74d8891
Merge branch 'master' into develop
binarywang Apr 13, 2020
6f57472
:bug: #1500 修复企业微信素材下载报错问题:Prefix string too short
BeHappyWsz Apr 13, 2020
2e75e46
:art: #1503 微信公众号模块提取redis抽象层、支持key前缀设置
lkqm Apr 13, 2020
f101374
:bug: 修复无效引用代码
binarywang Apr 14, 2020
2112db7
:bug: #1512 修复小程序直播官方文档live_satus字段拼错问题,调整为live_status
yjwang3300300 Apr 17, 2020
dc01e0b
:art: #1516 公众号spring-boot-starter 优化代码,增加http客户端和代理等配置
lkqm Apr 17, 2020
ea444f2
:art: #1519 会员卡相关接口优化,补充部分字段
silloy Apr 18, 2020
d938182
:art: #1507 企业微信MpnewsArticle类增加构造方法,避免某些情况下报错
binarywang Apr 18, 2020
340f341
:art: 优化代码
binarywang Apr 18, 2020
7feca8d
:art: #1521 微信小程序 spring-boot-starter 增加一些新特性
lkqm Apr 18, 2020
d60106c
:art: #1520 企业微信接收消息的类中加入群ID属性
binarywang Apr 18, 2020
7ace417
:bookmark: 发布 3.7.7.B 测试版本
binarywang Apr 19, 2020
585bd94
:art: #1522 开放平台优化redis存储配置类,同时对应的 spring boot starter 模块增加新特性
lkqm Apr 19, 2020
619b377
:bug: #1524 修复WxMaExpressPath.PathItem内部类为public,方便访问
binarywang Apr 21, 2020
6da4b4f
:art: #1528 优化企业微信获取客户列表的接口,同时增加更多的企业微信错误码枚举值
binarywang Apr 25, 2020
ebe4682
:art: 重构代码,抽取公共方法到接口
binarywang Apr 25, 2020
1ccce79
:bug: 微信支付完结分账接口服务商模式下签名时需要忽略subAppId
binarywang Apr 25, 2020
9472dd3
:bookmark: 发布 3.7.8.B 测试版本
binarywang Apr 25, 2020
172638b
:art: #1534 公众号模块更改http请求默认connectionRequestTimeout参数,以避免高并发场景下出现Conn…
niefy Apr 27, 2020
8805e97
:new: #1538 企业微信模块增加获取企业授权信息的接口
yuanqixun Apr 30, 2020
a907938
:arrow_up: 更新部分依赖jar包版本
binarywang May 2, 2020
561da62
:bug: #1540 修复WxDeviceBindDeviceResult类里的Device内部类为public
binarywang May 2, 2020
09100e6
:art: #1539 公众号错误信息枚举类修复一个错误码的msg信息标记错误的问题
binarywang May 2, 2020
42d92c0
:art: 规范一些字段命名
binarywang May 2, 2020
424a835
:art: 移除多余TicketType,移到common模块进行共享使用
binarywang May 2, 2020
98aef34
:art: #1542 小程序模块配置类增加Redisson的实现,解决分布式锁问题
yuanqixun May 3, 2020
eb38e86
:new: #1544 微信开放平台新增使用userstr参数解绑体验者的接口
GodDu May 6, 2020
8f5a9e0
:bug: #1547 修复小程序二维码创建参数包含中文时出现乱码的问题
howardliu-cn May 7, 2020
ef7516c
:new: #1556 增加微信支付或退款回调的时候返回xml字符串方法
1ibo May 11, 2020
95b02d2
:art: 优化代码
binarywang May 11, 2020
92ea01e
:art: #1550 企业微信TaskCardButton类增加无参构造方法
binarywang May 11, 2020
609b38a
:art: #1558 修复Java9及以上版本报非法反射警告信息的问题
duanhongyi May 12, 2020
058ce62
:bug: #1546 修复WxRedisOps问题, #1548 修复WxOpenInMemoryConfigStorage锁问题,#…
lkqm May 12, 2020
189669c
:new: #1305 增加商户开电子发票功能
lkqm May 12, 2020
7ee2772
:art: #1549 微信支付证书读取代码优化,支持读取打进jar包里的证书文件
binarywang May 12, 2020
a219035
:art: #1559 微信会员卡基本信息更新接口增加跳转小程序相关的几个参数
binarywang May 12, 2020
b87ec9a
:art: #1554 优化小程序获取token逻辑,减少刷新请求次数
binarywang May 13, 2020
6186d25
:bookmark: 发布 3.7.9.B 测试版本
binarywang May 13, 2020
cb3f105
:new: #1562企业微信自研应用增加Redisson的存储实现,支持分布式锁
yuanqixun May 14, 2020
0bc2cf9
:bug: #1564 微信卡包更新接口去掉多余有问题的参数字段
silloy May 18, 2020
8709a9c
:new: #1090 增加微信支付分和免押租借相关接口
spvycf May 19, 2020
39cea92
:art: 微信支付分相关接口代码重构规范化
binarywang May 19, 2020
40ab5dd
:art: 修复重构后的代码
binarywang May 19, 2020
4929e4e
:art: 优化代码
binarywang May 19, 2020
50e50c1
:art: 微信支付分支付回调接口优化以及补充测试代码
spvycf May 21, 2020
5c7b6d2
:art: 优化部分代码
binarywang May 21, 2020
11e81d8
:art: 优化代码
binarywang May 21, 2020
69ac4ec
:art: #1572 微信支付调起支付时的nonceStr参数使用统一下单时的参数值
binarywang May 21, 2020
ae1b14f
:art: #1575 小程序获取直播房间列表接口增加share_img字段
gguan May 22, 2020
bcefec0
:art: 优化代码
binarywang May 23, 2020
4eb1d1d
:art: #1571 对微信模版消息行业信息不一致的变态问题尽可能的进行优化
binarywang May 23, 2020
06c8ae8
:new: #1532 微信支付模块增加汇率查询的接口
binarywang May 23, 2020
ebc8f0e
:art: 优化代码,抽取方法,减少重复代码
binarywang May 23, 2020
9d2f90e
:art: 优化代码
binarywang May 24, 2020
3b46fae
:art: 优化微信支付v3代码,兼容java7
binarywang May 24, 2020
d8a1fce
:bookmark: 发布 3.8.0 正式版本
binarywang May 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
<packaging>pom</packaging>
<name>WxJava - Weixin/Wechat Java SDK</name>
<description>微信开发Java SDK</description>
Expand Down Expand Up @@ -116,7 +116,7 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<httpclient.version>4.5</httpclient.version>
<jetty.version>9.4.17.v20190418</jetty.version>
<jetty.version>9.4.28.v20200408</jetty.version>
</properties>

<dependencyManagement>
Expand All @@ -130,13 +130,13 @@
<dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd-http</artifactId>
<version>3.7.1</version>
<version>5.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.7.0</version>
<version>4.5.0</version>
<scope>provided</scope>
</dependency>

Expand All @@ -163,7 +163,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
<version>3.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -191,31 +191,31 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.7</version>
<version>2.10.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.11</version>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<version>4.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -243,10 +243,24 @@
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.jedis-lock</groupId>
<artifactId>jedis-lock</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.12.0</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.23.RELEASE</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
</parent>
<packaging>pom</packaging>
<artifactId>wx-java-spring-boot-starters</artifactId>
Expand Down
49 changes: 29 additions & 20 deletions spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
# 使用说明
1. 在自己的Spring Boot项目里,引入maven依赖
```xml
# wx-java-miniapp-spring-boot-starter
## 快速开始
1. 引入依赖
```xml
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId>
<version>${version}</version>
</dependency>
```
2. 添加配置(application.yml)
```yml
wx:
miniapp:
appid: 111
secret: 111
token: 111
aesKey: 111
msgDataFormat: JSON
```






```
2. 添加配置(application.properties)
```properties
# 公众号配置(必填)
wx.miniapp.appid = appId
wx.miniapp.secret = @secret
wx.miniapp.token = @token
wx.miniapp.aesKey = @aesKey
wx.miniapp.msgDataFormat = @msgDataFormat # 消息格式,XML或者JSON.
# 存储配置redis(可选)
# 注意: 指定redis.host值后不会使用容器注入的redis连接(JedisPool)
wx.miniapp.config-storage.type = jedis # 配置类型: memory(默认), jedis, redistemplate
wx.miniapp.config-storage.key-prefix = wa # 相关redis前缀配置: wa(默认)
wx.miniapp.config-storage.redis.host = 127.0.0.1
wx.miniapp.config-storage.redis.port = 6379
# http客户端配置
wx.miniapp.config-storage.http-client-type=httpclient # http客户端类型: httpclient(默认)
wx.miniapp.config-storage.http-proxy-host=
wx.miniapp.config-storage.http-proxy-port=
wx.miniapp.config-storage.http-proxy-username=
wx.miniapp.config-storage.http-proxy-password=
```
3. 自动注入的类型
- `WxMaService`
- `WxMaConfig`

13 changes: 12 additions & 1 deletion spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>3.7.0</version>
<version>3.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -19,6 +19,17 @@
<artifactId>weixin-java-miniapp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>${spring.boot.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import lombok.AllArgsConstructor;
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import me.chanjar.weixin.common.redis.WxRedisOps;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
* 自动配置.
Expand All @@ -26,7 +34,9 @@
@EnableConfigurationProperties(WxMaProperties.class)
@ConditionalOnProperty(prefix = "wx.miniapp", value = "enabled", matchIfMissing = true)
public class WxMaAutoConfiguration {
private WxMaProperties properties;

private final WxMaProperties wxMaProperties;
private final ApplicationContext applicationContext;

/**
* 小程序service.
Expand All @@ -35,16 +45,87 @@ public class WxMaAutoConfiguration {
*/
@Bean
@ConditionalOnMissingBean(WxMaService.class)
public WxMaService service() {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(StringUtils.trimToNull(this.properties.getAppid()));
config.setSecret(StringUtils.trimToNull(this.properties.getSecret()));
config.setToken(StringUtils.trimToNull(this.properties.getToken()));
config.setAesKey(StringUtils.trimToNull(this.properties.getAesKey()));
config.setMsgDataFormat(StringUtils.trimToNull(this.properties.getMsgDataFormat()));

public WxMaService service(WxMaConfig wxMaConfig) {
final WxMaServiceImpl service = new WxMaServiceImpl();
service.setWxMaConfig(config);
service.setWxMaConfig(wxMaConfig);
return service;
}

@Bean
@ConditionalOnMissingBean(WxMaConfig.class)
public WxMaConfig wxMaConfig() {
WxMaProperties.StorageType type = wxMaProperties.getConfigStorage().getType();
WxMaDefaultConfigImpl config;
if (type == WxMaProperties.StorageType.jedis) {
config = wxMaInJedisConfigStorage();
} else if (type == WxMaProperties.StorageType.redistemplate) {
config = wxMaInRedisTemplateConfigStorage();
} else {
config = wxMaInMemoryConfigStorage();
}

config.setAppid(StringUtils.trimToNull(this.wxMaProperties.getAppid()));
config.setSecret(StringUtils.trimToNull(this.wxMaProperties.getSecret()));
config.setToken(StringUtils.trimToNull(this.wxMaProperties.getToken()));
config.setAesKey(StringUtils.trimToNull(this.wxMaProperties.getAesKey()));
config.setMsgDataFormat(StringUtils.trimToNull(this.wxMaProperties.getMsgDataFormat()));

WxMaProperties.ConfigStorage configStorageProperties = wxMaProperties.getConfigStorage();
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
if (configStorageProperties.getHttpProxyPort() != null) {
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
}
return config;
}

private WxMaDefaultConfigImpl wxMaInMemoryConfigStorage() {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
return config;
}

private WxMaDefaultConfigImpl wxMaInJedisConfigStorage() {
WxMaProperties.RedisProperties redisProperties = wxMaProperties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
jedisPool = getJedisPool();
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
WxMaRedisBetterConfigImpl wxMaRedisConfig = new WxMaRedisBetterConfigImpl(redisOps, wxMaProperties.getConfigStorage().getKeyPrefix());
return wxMaRedisConfig;
}

private WxMaDefaultConfigImpl wxMaInRedisTemplateConfigStorage() {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
WxRedisOps redisOps = new RedisTemplateWxRedisOps(redisTemplate);
WxMaRedisBetterConfigImpl wxMaRedisConfig = new WxMaRedisBetterConfigImpl(redisOps, wxMaProperties.getConfigStorage().getKeyPrefix());
return wxMaRedisConfig;
}

private JedisPool getJedisPool() {
WxMaProperties.ConfigStorage storage = wxMaProperties.getConfigStorage();
WxMaProperties.RedisProperties redis = storage.getRedis();

JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);

return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(),
redis.getDatabase());
}
}
Loading