我有一个类似
的配置(config.properties
)
app.rootDir=
app.reportDir=${app.rootDir}/report
app.rootDir
不是固定参数,必须由外部模块初始化。我需要保持${app.reportDir}
保持对${app.rootDir}
的动态引用。
使用伪代码来说明问题:
// Init the root dir as '/usr/app'
config.setValue('app.rootDir','/usr/app');
// I need the reportDir to be '/usr/app/report'
String reportDir = config.getValue('app.reportDir');
我可以编写一些代码来获取此功能,但我想知道是否有任何现有的库这样做?
根据库的可用性,我可以使用属性,yaml或json作为配置文件类型。