We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
这个看起来很有趣,尽管我不得不承认我没有使用过它:
http://owner.aeonbits.org
This one looks interesting, though I have to admit I haven't used it:
http://owner.aeonbits.org
您是否已经看过 Apache Commons 配置?
Have you already had a look at Apache Commons Configuration?
我们在项目中使用 Constretto。非常轻巧且易于使用。
We use Constretto at our project. Very lightweight and easy to use.
您可以尝试cfg4j。它主要面向分布式应用程序,但支持大多数所需的功能。
You could give cfg4j a try. It's mostly oriented towards distributed apps but supports most of the requested features.
对于大多数要求,我已经能够使用标准属性来完成此任务。我将 Properties 对象包装在配置类中,该对象从以下位置读取属性文件:
配置类代码使得应用程序中的属性覆盖通用属性和文件系统属性会覆盖应用程序级别属性。
Configuration 作为 Spring bean 加载,并将其内部 Properties 对象公开给 PropertyPlaceholderConfigurer,这允许在 Spring xml 文件中进一步替换
$var
。由于配置是一个 Spring bean,因此可以将其注入到我需要的地方。像这样的东西应该可以扩展以处理 JSON 或 YAML 文件而不是属性文件以允许地图、列表等。
For most of the requirements, I have been able to accomplish this with standard Properties. I wrapped a Properties object in a configuration class that read properties file from:
The Configuration class code is such that properties in the application overwrite properties in common and the filesystem properties overwrite application level properties.
The Configuration is loaded as a Spring bean and exposes its internal Properties object to a PropertyPlaceholderConfigurer which allow further
$var
substitution in Spring xml files. Since the config is a Spring bean, it can be injected where ever I need it.Something like this should be extensible to handling JSON or YAML file instead of properties files to allow maps, list, etc.