package com.nantian.cloud.dbcapp.config;

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

public class OpsConfig {

    public static Properties ops = new Properties();
    public static InputStream myResource = OpsConfig.class.getResourceAsStream("/OpsConfig.properties");

    static {
        try {
            ops.load(myResource);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getOpsConfig(String props) {
        return ops.getProperty(props);
    }

   /* private static Properties prop = null;

    static{
        getResource();
    }
    
    public static String getOpsConfig(String tempCode){
        return (String) prop.get(tempCode);
    }

    public static Properties getResource() {
        if (prop == null) {
            synchronized (OpsConfig.class) {
                if (prop == null) {
                    try(InputStream in = new ClassPathResource("OpsConfig.properties").getInputStream();) {
                        prop = new Properties();
                        prop.load(new InputStreamReader(in,"UTF-8")); // 解决中文读取乱码问题
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
            return prop;
        } else {
            return prop;
        }
    }*/

}
