binarywang / weixin-java-miniapp-demo

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

是不是只支持单个小程序? 如果一个服务器支持多个小程序发送模板就不行 #5

Closed gclsoft closed 6 years ago

gclsoft commented 6 years ago
    @Bean
    @ConditionalOnMissingBean
    public WxMaConfig maConfig() {
        WxMaInMemoryConfig config = new WxMaInMemoryConfig();
        config.setAppid(this.properties.getAppid());
        config.setSecret(this.properties.getSecret());
        config.setToken(this.properties.getToken());
        config.setAesKey(this.properties.getAesKey());
        config.setMsgDataFormat(this.properties.getMsgDataFormat());

        return config;
    }

项目中要支持多个小程序

binarywang commented 6 years ago

自己配置多个config和对应的service即可

gclsoft commented 6 years ago

我们的小程序有十几个, 能不能不手动写config, 直接参数传进来可以吗?

gclsoft commented 6 years ago

这样我们每上一家小程序,就要手动写两个类,再更新服务端,有没有更好的解决方法?

binarywang commented 6 years ago

那你可以自己想其他办法,保证别串了配置

gclsoft commented 6 years ago

@binarywang 能否提供一个支持多小程序的demo, 谢谢, 我看了支持多公众号的demo,移过来老是报错:

Unsatisfied dependency expressed through field 'mulitConfigService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'net.vkits.platform.wxService.MulitConfigService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
gclsoft commented 6 years ago

@binarywang 这个我参考了别人写的服务号的那个多账号的解决了,但是第三方平台的要怎么支持多配置账号呢? https://github.com/Wechat-Group/weixin-java-open-demo/issues/6

binarywang commented 6 years ago

抽空可以改造下这个demo,公众号的springboot的demo已经改造完毕