Config 类
程序员文章站
2022-04-26 14:06:31
...
package com.empl.mgr.baseDao.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class Config {
private static Properties props = new Properties();
static {
ClassLoader loader = Config.class.getClassLoader();
InputStream in = loader.getResourceAsStream("config.properties");
try {
props.load(in);
} catch (IOException e) {
e.printStackTrace();
}
}
public static String getString(String key) {
return props.getProperty(key);
}
}