代码拉取完成,页面将自动刷新
jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户使用。
具体demo请查看:mica-weixin-demo
和 JFinal-weixin文档
Avue
一款基于vue可配置化的神奇框架:https://gitee.com/smallweigit/avue
pig
宇宙最强微服务(架构师必备):https://gitee.com/log4j/pig
SpringBlade
完整的线上解决方案(企业开发必备):https://gitee.com/smallc/SpringBlade
IJPay
支付SDK让支付触手可及:https://gitee.com/javen205/IJPay
version | spring boot version | java version |
---|---|---|
3.0.0 | 3.x | 17 |
2.1.2 | 1.x ~ 2.x | 1.8 |
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-weixin</artifactId>
<version>3.0.0</version>
</dependency>
继承DreamMsgControllerAdapter
,实现需要重写的消息。
类添加注解@WxMsgController
,注解value为你的消息地址,使用/weixin/wx,已经组合[@RequestMapping和@Controller]
继承DreamWxaMsgController
,实现需要重写的消息。
添加注解@WxMsgController
,注解value为你的消息地址,使用/weixin/wxa,已经组合[@RequestMapping和@Controller]
@WxApi
,注解value为你的消息地址,使用/weixin/api,已经组合[@RequestMapping和@Controller]您可以配置 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 | 小程序配置 | 小程序配置 |
注意
:
application.yml
dream:
weixin:
dev-mode: true
wx-configs:
- appId: wx9803d1188fa5fbda
appSecret: db859c968763c582794e7c3d003c3d87
- appId: wxc03edcd008ad1e70
appSecret: 11ed9e2b8e3e3c131e7be320a42b2b5a
token: 123456
encodingAesKey: xxx
messageEncrypt: true
wxa-configs:
- app-id: wx4f53594f9a6b3dcb
app-secret: eec6482ba3804df05bd10895bace0579
access-token-cache
建议配置有效时间7100秒。注意:实现 WxConfigLoader
即可,可以从数据库中获取。
/**
* 微信配置加载器,用于自定义实现
*
* @author L.cm
*/
@Configuration
public class WxConfigDatabaseLoader implements WxConfigLoader {
@Override
public List<ApiConfig> loadWx() {
// 公众号
ApiConfig wxConf = new ApiConfig();
wxConf.setAppId("wxc03edcd008ad1e70");
wxConf.setAppSecret("11ed9e2b8e3e3c131e7be320a42b2b5a");
wxConf.setToken("123456");
return Collections.singletonList(wxConf);
}
@Override
public List<WxaConfig> loadWxa() {
// 小程序
return Collections.emptyList();
}
}
dreamWeixinCache#7100s
,方便和 mica-redis
一起使用。gradle 5.2.1
。JFinal
到 3.6
。JFinal Weixin
到 2.3
。mica-auto
生成 spring.factories
、devtools
配置。InMsg
消息对象采用 request
存储,去掉 @WxMsgController
中的 Scope 配置,将消息控制器还原为单例。SpringAccessTokenCache
没有配置的问题,感谢 qq:A梦的小C
反馈。WeixinAppConfig
改为实现 SmartInitializingSingleton
。@EnableDreamWeixin
,导入jar包即可享用。精彩内容每日推荐!
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型