protected String getProperty(String name) {
String file = "/META-INF/jndi.properties";
URL fileURL = this.getClass().getResource(file);
if (fileURL != null) {
try {
props.load(this.getClass().getResourceAsStream(file));
} catch (IOException e) {
e.printStackTrace();
}
}
return props.getProperty(name);
}
META-INF下文件读取
最新推荐文章于 2024-01-09 20:19:21 发布
本文介绍了一种从特定路径加载属性文件并读取其内容的方法。通过使用Java的类加载器,可以从/META-INF/jndi.properties文件中读取属性,并在程序中使用这些属性值。
1138

被折叠的 条评论
为什么被折叠?



