2020-04-19 22:36:04 +08:00
|
|
|
|
# wx-java-mp-spring-boot-starter
|
2024-05-09 00:24:59 +08:00
|
|
|
|
|
2019-05-10 14:48:22 +08:00
|
|
|
|
## 快速开始
|
2024-05-09 00:24:59 +08:00
|
|
|
|
|
2019-05-10 14:48:22 +08:00
|
|
|
|
1. 引入依赖
|
|
|
|
|
```xml
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>com.github.binarywang</groupId>
|
2019-08-10 18:03:00 +08:00
|
|
|
|
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
|
2019-05-10 14:48:22 +08:00
|
|
|
|
<version>${version}</version>
|
|
|
|
|
</dependency>
|
|
|
|
|
```
|
|
|
|
|
2. 添加配置(application.properties)
|
|
|
|
|
```properties
|
|
|
|
|
# 公众号配置(必填)
|
2024-05-09 00:24:59 +08:00
|
|
|
|
wx.mp.app-id=appId
|
|
|
|
|
wx.mp.secret=@secret
|
|
|
|
|
wx.mp.token=@token
|
|
|
|
|
wx.mp.aes-key=@aesKey
|
|
|
|
|
wx.mp.use-stable-access-token=@useStableAccessToken
|
2020-04-17 15:45:43 +08:00
|
|
|
|
# 存储配置redis(可选)
|
2024-05-09 00:24:59 +08:00
|
|
|
|
wx.mp.config-storage.type= edis # 配置类型: Memory(默认), Jedis, RedisTemplate
|
|
|
|
|
wx.mp.config-storage.key-prefix=wx # 相关redis前缀配置: wx(默认)
|
|
|
|
|
wx.mp.config-storage.redis.host=127.0.0.1
|
|
|
|
|
wx.mp.config-storage.redis.port=6379
|
2020-09-27 17:25:32 +08:00
|
|
|
|
#单机和sentinel同时存在时,优先使用sentinel配置
|
|
|
|
|
#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
|
2020-04-17 15:45:43 +08:00
|
|
|
|
# http客户端配置
|
2020-08-30 10:50:25 +08:00
|
|
|
|
wx.mp.config-storage.http-client-type=httpclient # http客户端类型: HttpClient(默认), OkHttp, JoddHttp
|
2020-04-17 15:45:43 +08:00
|
|
|
|
wx.mp.config-storage.http-proxy-host=
|
|
|
|
|
wx.mp.config-storage.http-proxy-port=
|
|
|
|
|
wx.mp.config-storage.http-proxy-username=
|
|
|
|
|
wx.mp.config-storage.http-proxy-password=
|
2020-09-27 17:25:32 +08:00
|
|
|
|
# 公众号地址host配置
|
|
|
|
|
#wx.mp.hosts.api-host=http://proxy.com/
|
|
|
|
|
#wx.mp.hosts.open-host=http://proxy.com/
|
|
|
|
|
#wx.mp.hosts.mp-host=http://proxy.com/
|
2019-05-10 14:48:22 +08:00
|
|
|
|
```
|
2020-04-19 22:36:04 +08:00
|
|
|
|
3. 自动注入的类型
|
2024-05-09 00:24:59 +08:00
|
|
|
|
|
2020-09-05 10:19:33 +08:00
|
|
|
|
- `WxMpService`
|
2020-04-19 22:36:04 +08:00
|
|
|
|
- `WxMpConfigStorage`
|
2019-05-10 14:48:22 +08:00
|
|
|
|
|
2020-09-05 10:19:33 +08:00
|
|
|
|
4、参考demo:
|
|
|
|
|
https://github.com/binarywang/wx-java-mp-demo
|