Autowiring WxMpConfigStorage - Hippoom/wechat-mp-starter GitHub Wiki
The starter provides a WxMpInMemoryConfigStorage
instance by default. You can setup your WeChat MP appId and secret in the application{-profile}.properties or application{-profile}.yaml
wechat:
mp:
appId: your-app-id
appSecret: your-app-secret
aesKey: your-aes-key-if-needed
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;
}
}