WxMpService 报错,是缺少配置文件
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class WxMpConfig {
@Bean
public WxMpDefaultConfigImpl wxMpDefaultConfig(){
WxMpDefaultConfigImpl wxMpDefaultConfig=new WxMpDefaultConfigImpl();
wxMpDefaultConfig.setAppId("");
wxMpDefaultConfig.setSecret("");
wxMpDefaultConfig.setToken("");
wxMpDefaultConfig.setAesKey("");
return wxMpDefaultConfig;
}
@Bean
public WxMpService wxService(){
WxMpService wxMpService=new WxMpServiceImpl();
wxMpService.setWxMpConfigStorage(wxMpDefaultConfig());
return wxMpService;
}
}