package com.kmall.common.utils.redis;

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 JedisPropertiesBuilder {
    private static final Logger logger = LoggerFactory.getLogger(JedisPropertiesBuilder.class);

    @Autowired
    @Qualifier("jedisProperties")
    private JedisProperties jedisProperties;

    private static JedisProperties jedisProp;

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

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

}
