package com.kmall.api.service.pay.wxpay;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author Scott Chen
 * @since 1.0
 * 2018-09-27
 */
@Component
public class WxPayPropertiesBuilder {
    private static final Logger logger = LoggerFactory.getLogger(WxPayPropertiesBuilder.class);

    @Autowired
    @Qualifier("wxPayProperties")
    private WxPayProperties wxPayProperties;

    private static WxPayProperties wxPayProp;

    /**
     * Bean 向静态变量赋值
     */
    @PostConstruct
    private void init(){
        logger.info("WxPayProperties初始化开始......");
        wxPayProp = wxPayProperties;
    }

    public static WxPayProperties instance(){
        logger.info("WxPayProperties实例返回");
        return wxPayProp;
    }

}
