如何从普通 Java 类的 Web 应用程序中的 meta-inf 文件夹中读取属性文件。
最佳答案
您可以做的最简单的事情是:-
InputStream propertiesIs = this.getClass().getClassLoader().getResourceAsStream("META-INF/your.properties");
Properties prop = new Properties();
prop.load(propertiesIs);
System.out.println(prop.getProperty(YourPropertyHere));
或者
您也可以尝试使用 FileInputStream
加载属性:-
input = new FileInputStream("META-INF/your.properties");
关于java - 如何从 POJO 的 meta-inf 文件夹中读取属性文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31316490/