标签:
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* 读取配置文件
* @author zhangrujing
*
*/
public enum Config {
INSTANCE;
private volatile Properties configuration = new Properties();
public void init() {
getConfiguration("system-config");
}
private void getConfiguration(String nodeName) {
InputStream is = this.getClass().getResourceAsStream("/" + nodeName + ".properties");
if (is != null) {
try {
this.configuration.clear();
this.configuration.load(is);
} catch (IOException e) {
} finally {
try {
is.close();
} catch (Throwable t) {}
}
}
}
public String getConfigValue(String key) {
return this.configuration.getProperty(key);
}
}
求大神指导如何读取多个配置文件
标签:
原文地址:http://www.cnblogs.com/IT-Monster/p/4247939.html