binarywang / weixin-java-miniapp-demo

基于Spring Boot 和 WxJava 实现的微信小程序Java后端Demo
1.33k stars 674 forks source link

关于配置config的问题 #20

Closed Crown-wg closed 4 years ago

Crown-wg commented 4 years ago

image 当我把sdk引进并按照demo使用时,出现如图错误。请帮忙查看是什么问题?谢谢 @PostConstruct public void init() { List configs = this.properties.getConfigs(); if (configs == null) { throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!"); }

    maServices = configs.stream()
        .map(a -> {
            WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
            config.setAppid(a.getAppid());
            config.setSecret(a.getSecret());
            config.setToken(a.getToken());
            config.setAesKey(a.getAesKey());
            config.setMsgDataFormat(a.getMsgDataFormat());

            WxMaService service = new WxMaServiceImpl();
            service.setWxMaConfig(config);
            routers.put(a.getAppid(), this.newRouter(service));
            return service;
        }).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a));
}
Peiyongliang commented 2 years ago

怎么解决的

miozus commented 2 years ago

怎么解决的

tunghsingw commented 1 year ago

官方示例使用 stream()增加了些心智负担,不是所有人都熟悉最新接口的

binarywang commented 1 year ago

stream是java8早就引入的语法了吧,除非你是个老司机,都还没接触过?