io.gitee.putaoo.easypay.config.WxpayConfig Maven / Gradle / Ivy
package io.gitee.putaoo.easypay.config;
import io.gitee.putaoo.easypay.constant.WxConstant;
import io.gitee.putaoo.easypay.feign.WxpayApi;
import io.gitee.putaoo.easypay.feign.WxpaySandboxApi;
import io.gitee.putaoo.easypay.handler.PayHandler;
import io.gitee.putaoo.easypay.handler.WxpayHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableConfigurationProperties(WxPayProperties.class)
public class WxpayConfig {
@Bean(WxConstant.NAME)
@ConditionalOnProperty(name = "easy.pay.wxpay.enable",havingValue = "true")
PayHandler wxpayHandler(WxPayProperties wxPayProperties,WxpayApi wxpayApi, WxpaySandboxApi wxpaySandboxApi){
return new WxpayHandler(wxpayApi,wxpaySandboxApi,wxPayProperties);
}
}