package com.izouma.nineth.config; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; import lombok.AllArgsConstructor; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @AllArgsConstructor @Configuration @EnableConfigurationProperties(WxMaProperties.class) public class WxMaConfiguration { private final WxMaProperties properties; @Bean public WxMaService wxMaService() { WxMaService service = new WxMaServiceImpl(); WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); config.setAppid(properties.getAppId()); config.setSecret(properties.getAppSecret()); config.setToken(properties.getMsgToken()); config.setAesKey(properties.getMsgAesKey()); config.setMsgDataFormat(properties.getMsgFormat()); service.setWxMaConfig(config); return service; } }