README.md 2.8 KB
Newer Older
如梦技术's avatar
如梦技术 已提交
1 2 3
## 说明
jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户使用。

如梦技术's avatar
如梦技术 已提交
4
具体demo请查看:`spring-boot-weixin-demo`[JFinal-weixin文档](https://gitee.com/jfinal/jfinal-weixin/wikis/pages?title=Home)
如梦技术's avatar
如梦技术 已提交
5 6 7 8 9 10

## Jar包依赖
```xml
<dependency>
    <groupId>net.dreamlu</groupId>
    <artifactId>spring-boot-starter-weixin</artifactId>
如梦技术's avatar
v1.3.0  
如梦技术 已提交
11
    <version>1.3.0</version>
如梦技术's avatar
如梦技术 已提交
12 13 14 15 16 17 18 19
</dependency>
```

`说明`:依赖`spring-boot-starter-aop`

## 使用
### 消息
#### 公众号
如梦技术's avatar
v1.3.0  
如梦技术 已提交
20
1. 继承`DreamMsgControllerAdapter`,实现需要重写的消息。
如梦技术's avatar
如梦技术 已提交
21

如梦技术's avatar
v1.3.0  
如梦技术 已提交
22
2. 类添加注解`@WxMsgController`,注解value为你的消息地址,使用/weixin/wx,已经组合[@RequestMapping和@Controller]
如梦技术's avatar
如梦技术 已提交
23 24

### 小程序
如梦技术's avatar
v1.3.0  
如梦技术 已提交
25
1. 继承`DreamWxaMsgController`,实现需要重写的消息。
如梦技术's avatar
如梦技术 已提交
26

如梦技术's avatar
v1.3.0  
如梦技术 已提交
27
2. 添加注解`@WxMsgController`,注解value为你的消息地址,使用/weixin/wxa,已经组合[@RequestMapping和@Controller]
如梦技术's avatar
如梦技术 已提交
28 29

### Api
如梦技术's avatar
v1.3.0  
如梦技术 已提交
30
- 类添加`@WxApi`注解,已经组合[@RequestMapping和@Controller]
如梦技术's avatar
如梦技术 已提交
31 32

### 配置
如梦技术's avatar
如梦技术 已提交
33 34
| 配置项 | 默认值 | 说明 |
| ----- | ------ | ------ |
如梦技术's avatar
如梦技术 已提交
35
| dream.weixin.access-token-cache | dreamWeixinCache | 缓存名,需要开启spring cache |
如梦技术's avatar
如梦技术 已提交
36
| dream.weixin.app-id-key | appId | 多公众号参数名,如:/weixin/wx?appId=xxx |
如梦技术's avatar
如梦技术 已提交
37
| dream.weixin.dev-mode | false | 开发模式 |
如梦技术's avatar
v1.3.0  
如梦技术 已提交
38
| dream.weixin.url-patterns | /weixin/* | weixin 消息处理spring拦截器url前缀 |
如梦技术's avatar
如梦技术 已提交
39 40 41
| dream.weixin.wx-configs | 公众号的配置 | 多公众号配置 |
| dream.weixin.wxa-config | 小程序配置 | 小程序配置 |

如梦技术's avatar
如梦技术 已提交
42
`注意`
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
- demo中的`application.yml`
```yml
dream:
  weixin:
    dev-mode: true
    wx-configs:
      - appId: wx9803d1188fa5fbda
        appSecret: db859c968763c582794e7c3d003c3d87
      - appId: wxc03edcd008ad1e70
        appSecret: 11ed9e2b8e3e3c131e7be320a42b2b5a
        token: 123456
    wxa-config:
      appid: wx4f53594f9a6b3dcb
      appSecret: eec6482ba3804df05bd10895bace0579
```

如梦技术's avatar
如梦技术 已提交
59 60 61
- cache使用spring的cache,需要`@EnableCaching`开启。
- `access-token-cache`建议配置有效时间7100秒。

如梦技术's avatar
v1.3.0  
如梦技术 已提交
62 63 64 65 66
## 更新说明
>## 2018-05-03 v1.3.0
> 弃用`@EnableDreamWeixin`,导入jar包即可享用。
> 将消息路由改为spring接管。

如梦技术's avatar
如梦技术 已提交
67 68 69 70 71
## 捐助共勉
 <img src="https://gitee.com/uploads/images/2018/0311/153544_5afb12b1_372.jpeg" width="250px"/>
 <img src="https://gitee.com/uploads/images/2018/0311/153556_679db579_372.jpeg" width="250px"/>

## VIP群
72
捐助~~¥199~~限时¥99,即可加入如梦技术VIP,捐助后联系QQ: 596392912
如梦技术's avatar
如梦技术 已提交
73 74 75 76

#### VIP权益
1. spring boot版安全框架(maven + spring boot + spring security + thymeleaf)

77
2. 技术资料共享,技术指导和技术路线规划。
如梦技术's avatar
如梦技术 已提交
78 79 80 81

3. spring cloud脚手架(改造中)

4. 更多私有Git资源,
82 83 84 85 86

### spring boot版安全框架 Demo
地址:http://demo.dreamlu.net

账号vs密码:test、test