package cn.necsthz.lvshitong.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class MobliePropertiesUtil {
private static String fileName = "/moblie.properties";
private static Properties p = new Properties();
static {
InputStream in = null;
try {
in = MobliePropertiesUtil.class.getResourceAsStream(fileName);// 类加载器
p.load(in);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static String get(String key) {
String value = null;
if (p.containsKey(key)) {
value = p.getProperty(key);
}
return value;
}
}
获取 properties的值
最新推荐文章于 2022-07-28 11:22:37 发布