对于,我尝试加载多个java属性文件。
我想知道是否可以在一个文件中“导入/包括”其他文件,所以我只需要加载第一个文件,其余的文件都将被导入。
例如。
common.properties
include 'specific.properties'
propertyA=10
propertyB=20specific.properties
propertyC=30
propertyD=40所以最终我会
propertyA=10
propertyB=20
propertyC=30
propertyD=40目前,我只是用
CompositeConfiguration config = new CompositeConfiguration();
config.addConfiguration(new PropertiesConfiguration("common.properties"));
config.addConfiguration(new PropertiesConfiguration("specific.properties"));,提前谢谢!
发布于 2017-03-20 22:40:45
这是可能的。从文件中复制:
如果属性名为"include",且该属性的值是磁盘上文件的名称,则该文件将包含在配置中。
在您的例子中(common.properties):
include = specific.properties
propertyA = 10
propertyB = 20specific.properties
propertyC = 30
propertyD = 40https://stackoverflow.com/questions/42913884
复制相似问题