说明
jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户使用。
具体demo请查看:mica-weixin-demo
和 JFinal-weixin文档
开源推荐
- Spring boot 微服务,高效开发之 mica 工具集:https://gitee.com/596392912/mica
Avue
一款基于vue可配置化的神奇框架:https://gitee.com/smallweigit/avuepig
宇宙最强微服务(架构师必备):https://gitee.com/log4j/pigSpringBlade
完整的线上解决方案(企业开发必备):https://gitee.com/smallc/SpringBladeIJPay
支付SDK让支付触手可及:https://gitee.com/javen205/IJPay
兼容性
支持 Spring boot 1.x 和 2.x
Jar包依赖(最新)
<dependency> |
使用
消息
公众号
- 继承
DreamMsgControllerAdapter
,实现需要重写的消息。 - 类添加注解
@WxMsgController
,注解value为你的消息地址,使用/weixin/wx,已经组合[@RequestMapping和@Controller]
小程序
- 继承
DreamWxaMsgController
,实现需要重写的消息。 - 添加注解
@WxMsgController
,注解value为你的消息地址,使用/weixin/wxa,已经组合[@RequestMapping和@Controller]
Api
- 类添加
@WxApi
,注解value为你的消息地址,使用/weixin/api,已经组合[@RequestMapping和@Controller]
access token cache
您可以配置 mica-caffeine 或 mica-redis 实现 access token 的缓存。
配置
配置项 | 默认值 | 说明 |
---|---|---|
dream.weixin.access-token-cache | dreamWeixinCache#7100s | 缓存名,需要开启spring cache |
dream.weixin.app-id-key | appId | 多公众号参数名,如:/weixin/wx?appId=xxx |
dream.weixin.dev-mode | false | 开发模式 |
dream.weixin.url-patterns | /weixin/* | weixin 消息处理spring拦截器url前缀 |
dream.weixin.wx-configs | 公众号的配置 | 多公众号配置 |
dream.weixin.wxa-configs | 小程序配置 | 小程序配置 |
注意
:
- demo中的
application.yml
dream: |
access-token-cache
建议配置有效时间7100秒。
自定义公众号vs小程序配置
注意:实现 WxConfigLoader
即可,可以从数据库中获取。
/** |
微信 vs 公众号
精彩内容每日推荐!!!