package com.kmall.manager.manager.pay.data.open.websocket;

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 huangyaqin
 * @since 1.0
 * 2018-10-24
 */
@Component
public class WebsocketPropertiesBuilder {
    private static final Logger logger = LoggerFactory.getLogger(WebsocketPropertiesBuilder.class);

    @Autowired
    @Qualifier("websocketProperties")
    private WebsocketProperties websocketProperties;

    private static WebsocketProperties websocketProp;

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

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

}
