Properties prop = new Properties();
InputStream in;
try {
in = this.getClass().getClassLoader().getResourceAsStream("domain.properties");
prop.load(in); // 加载属性列表
Iterator<String> it = prop.stringPropertyNames().iterator();
while (it.hasNext()) {
String key = it.next();//获取键
String value=prop.getProperty(key);//通过键获取值
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
java读取配置文件
最新推荐文章于 2024-07-27 17:56:15 发布