Skip to content

Autowiring WxMpConfigStorage

Hippoom edited this page Jun 29, 2017 · 3 revisions

The starter will provide a WxMpInMemoryConfigStorage instance by default. You can provide a WxMpInRedisConfigStorage instance if you opt for a redis store:

    @Configuration
    public class YourWeChatMpConfiguration { 
        @Bean
        protected WxMpConfigStorage configStorage(WeChatMpProperties weChatMpProperties) {
            WxMpInRedisConfigStorage configStorage = new WxMpInRedisConfigStorage();
            configStorage.setAppId(weChatMpProperties.getAppId());
            configStorage.setSecret(weChatMpProperties.getAppSecret());
            configStorage.setToken(weChatMpProperties.getToken());
            configStorage.setAesKey(weChatMpProperties.getAesKey());
            // omitted setters
            return configStorage;
        }
    }
Clone this wiki locally