修改配置
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.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.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.context.annotation.ScopedProxyMode;
|
||||
|
||||
|
||||
/**
|
||||
* Created by kellen on 2020/5/3. 微信小程序服务配置
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class WxMaConfiguration {
|
||||
|
||||
@Value("${wxma.app_id}")
|
||||
private String appId;
|
||||
@Value("${wxma.app_secret}")
|
||||
private String appSecret;
|
||||
|
||||
@Bean
|
||||
@Scope(value = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
public WxMaService wxMaService() {
|
||||
|
||||
WxMaDefaultConfigImpl wxMaDefaultConfig = new WxMaDefaultConfigImpl();
|
||||
wxMaDefaultConfig.setAppid(appId);
|
||||
wxMaDefaultConfig.setSecret(appSecret);
|
||||
|
||||
WxMaServiceImpl wxMaService = new WxMaServiceImpl();
|
||||
wxMaService.setWxMaConfig(wxMaDefaultConfig);
|
||||
|
||||
return wxMaService;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
cn.iocoder.yudao.config.WxCpConfigure
|
||||
cn.iocoder.yudao.config.WxCpConfigure,\
|
||||
cn.iocoder.yudao.config.WxMaConfiguration
|
||||
|
||||
Reference in New Issue
Block a user