【发布时间】:2012-07-31 05:48:23
【问题描述】:
我有 2 个属性文件:
application.properties 配置属性
这两个字段都包含属性。
我正在通过在 IBM websphere 服务器中设置系统属性来加载这些字段的属性。
在应用程序启动期间,这两个文件中的所有属性都通过ApplicationProperty.java 类加载。
private static Properties applicationProperties = new Properties();
readPropertyFileOne(...){
properties.load(new FileInputStream(propertiesLocationOne));
}
readPropertyFileTwo(...){
properties.load(new FileInputStream(propertiesLocationTwo));
}
现在在应用程序启动并读取两个文件中的所有属性之后。如果我尝试通过此代码访问文件中的任何属性
findNonNullableProperty(String aPropertyName){
String value = properties.getProperty(aPropertyName);
if(value == null){
//print system property name here. Name can be propertiesLocationOne or propertiesLocationTwo. But what is that? I want to know file location.
}
}
它返回 null。
【问题讨论】:
-
你的问题我不清楚。 app.property 到底是什么?属性文件?系统属性?属性在哪里定义,在哪里初始化?
标签: java properties jvm