我有两个属性文件,但是出了点问题,inputStream 总是为空?
<application>
<resource-bundle>
<base-name>resources/Bundle</base-name>
<var>bundle</var>
</resource-bundle>
<locale-config>
<default-locale>fi</default-locale>
<supported-locale>fi</supported-locale>
</locale-config>
<resource-bundle>
<base-name>resources/avainsanat</base-name>
<var>avainsanat</var>
</resource-bundle>
</application>
public static List getAvainsanat() throws IOException {
InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream("avainsanat.properties");
Properties properties = new Properties();
List<String> values = new ArrayList<>();
System.out.println("InputStream is: " + input);
for (String key : properties.stringPropertyNames()) {
String value = properties.getProperty(key);
values.add(value);
}
return values;
}
是否有可能在 faces-config 中有两个或多个属性文件?如果没有,我如何才能从我的包中只读取那些键具有前缀 key_ 的属性?
谢谢萨米