标签:pre private conf style use res sim final stat
1、properties配置文件的信息
fcsimage_path=C://FCSImage
2、Java代码
public final class Config { private static final Object lock = new Object(); private static volatile Properties config; private Config(){} private static Properties getInstance(){ if (config == null) { //double lock check synchronized (lock) { // declare a private static Object to use for mutex if( config == null ){ // have to do this inside the sync config = new Properties(); } } try { config.load(Config.class.getClassLoader().getResourceAsStream("common.properties")); } catch (IOException e) { e.printStackTrace(); } } return config; } public static String fcsimage_path() { return getInstance().getProperty("fcsimage_path"); } }
标签:pre private conf style use res sim final stat
原文地址:http://www.cnblogs.com/zhangjinru123/p/7645409.html