package com.qxgmat.util.servlet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by gaojie on 2017/5/11.
 */
public class Configure {

    private static final Logger logger = LoggerFactory.getLogger(Configure.class);
    public static Properties payProperties = new Properties();

    static {
//        loadProps();
    }

    synchronized static private void loadProps() {
        logger.debug("开始加载properties文件内容.......");
        InputStream in = null;
        try {
            in = Configure.class.getClassLoader().getResourceAsStream("config.properties");
            payProperties.load(in);
        } catch (FileNotFoundException e) {
            logger.error("config.properties文件未找到");
        } catch (IOException e) {
            logger.error("出现IOException");
        } finally {
            try {
                if (null != in) {
                    in.close();
                }
            } catch (IOException e) {
                logger.error("config.properties文件流关闭出现异常");
            }
        }
        logger.debug("加载properties文件内容完成...........");
        logger.debug("properties文件内容：" + payProperties);
    }
}
