1
1
package com .github .binarywang .demo .wx .mp .config ;
2
2
3
- import com .github .binarywang .demo .wx .mp .handler .*;
3
+ import java .util .Map ;
4
+ import java .util .stream .Collectors ;
5
+
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .boot .context .properties .EnableConfigurationProperties ;
8
+ import org .springframework .context .annotation .Bean ;
9
+ import org .springframework .context .annotation .Configuration ;
10
+
11
+ import com .github .binarywang .demo .wx .mp .handler .KfSessionHandler ;
12
+ import com .github .binarywang .demo .wx .mp .handler .LocationHandler ;
13
+ import com .github .binarywang .demo .wx .mp .handler .LogHandler ;
14
+ import com .github .binarywang .demo .wx .mp .handler .MenuHandler ;
15
+ import com .github .binarywang .demo .wx .mp .handler .MsgHandler ;
16
+ import com .github .binarywang .demo .wx .mp .handler .NullHandler ;
17
+ import com .github .binarywang .demo .wx .mp .handler .StoreCheckNotifyHandler ;
18
+ import com .github .binarywang .demo .wx .mp .handler .SubscribeHandler ;
19
+ import com .github .binarywang .demo .wx .mp .handler .UnsubscribeHandler ;
4
20
import com .google .common .collect .Maps ;
5
21
import me .chanjar .weixin .mp .api .WxMpInMemoryConfigStorage ;
6
22
import me .chanjar .weixin .mp .api .WxMpMessageRouter ;
7
23
import me .chanjar .weixin .mp .api .WxMpService ;
8
24
import me .chanjar .weixin .mp .api .impl .WxMpServiceImpl ;
9
25
import me .chanjar .weixin .mp .constant .WxMpEventConstants ;
10
- import org .springframework .beans .factory .annotation .Autowired ;
11
- import org .springframework .boot .context .properties .EnableConfigurationProperties ;
12
- import org .springframework .context .annotation .Bean ;
13
- import org .springframework .context .annotation .Configuration ;
14
-
15
- import java .util .Map ;
16
- import java .util .stream .Collectors ;
17
26
18
27
import static me .chanjar .weixin .common .api .WxConsts .*;
19
28
@@ -67,6 +76,7 @@ public static Map<String, WxMpService> getMpServices() {
67
76
68
77
@ Bean
69
78
public Object services () {
79
+ // 代码里getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
70
80
mpServices = this .properties .getConfigs ()
71
81
.stream ()
72
82
.map (a -> {
@@ -76,9 +86,6 @@ public Object services() {
76
86
configStorage .setToken (a .getToken ());
77
87
configStorage .setAesKey (a .getAesKey ());
78
88
79
- // WxMpService wxMpService = new me.chanjar.weixin.mp.api.impl.WxMpServiceOkHttpImpl();
80
- // WxMpService wxMpService = new me.chanjar.weixin.mp.api.impl.WxMpServiceJoddHttpImpl();
81
- // WxMpService wxMpService = new me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl();
82
89
WxMpService service = new WxMpServiceImpl ();
83
90
service .setWxMpConfigStorage (configStorage );
84
91
routers .put (a .getAppId (), this .newRouter (service ));
0 commit comments