31 lines
993 B
Java
31 lines
993 B
Java
package com.youlai.boot.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 com.youlai.boot.config.property.WxMaProperties;
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
/**
|
|
* 微信小程序配置
|
|
*
|
|
* @author Ray.Hao
|
|
* @since 2024/01/01
|
|
*/
|
|
@Configuration
|
|
@EnableConfigurationProperties(WxMaProperties.class)
|
|
public class WxMaConfig {
|
|
|
|
@Bean
|
|
public WxMaService wxMaService(WxMaProperties properties) {
|
|
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
|
config.setAppid(properties.getAppid());
|
|
config.setSecret(properties.getSecret());
|
|
WxMaService service = new WxMaServiceImpl();
|
|
service.setWxMaConfig(config);
|
|
return service;
|
|
}
|
|
}
|