是否有任何 Java Web 应用程序可以动态地允许发布 .properties 文件的内容并让我修改它?

发布于 2024-09-18 14:41:04 字数 269 浏览 4 评论 0原文

作为某些用例的所有开发的一部分,我使用了属性文件方法来处理项目中的几乎所有配置参数。

即使这种方法是一种安全方法,我也需要能够更改应用程序上的此参数,因此我需要一个管理 Web 模块,以便能够在运行时更改属性文件上的所有配置。

我想知道是否可以在我的网站上放置任何 WAR 以启用动态 Web 应用程序修改。

我发现 Apache Commons Configuration 使我能够进行运行时修改,但我还没有找到属性文件的 CRUD 应用程序。

有人知道吗?

As part of all the development of some use cases, I've used a properties file approach to handle almost all the configuration parameters in the project.

Even when this approach is a security safe approach, I need to be able to change this parameters on the application, so I need an admin web module to be able to change at runtime all the configuration on the properties file.

I would like to know if there's any WAR that I can put on my website to enable dynamic web application modification.

I found that the Apache Commons Configuration enables me to do runtime modifications, but I haven't found a CRUD application for properties files.

Does anyone know one?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一片旧的回忆 2024-09-25 14:41:04

同意艾萨克和拉夫普的评论。即使您确实设法在运行时更新属性文件的内容,这也无法解决大多数属性可能只加载一次并且在应用程序重新启动之前不会再次读取的问题。您最好使用 Java EE 环境条目或支持数据库。

另一种选择是使用 JMX 管理 bean。然后可以通过任何 JMX 管理工具(包括 jconsole)访问这些 bean,或者您也可以使用任何可用的 Web 前端来访问它们,包括应用程序服务器提供的任何前端。

Agreed with Isaac's and ruffp's comments. Even if you did manage a way to update the contents of the property files at runtime, this wouldn't solve the issue that most of the properties are likely loaded once and not read again until the application is restarted. You're best off using Java EE environment entries, or a backing database.

Another option is to use JMX management beans. These beans could then be accessed through any JMX management tool, including jconsole - or your could use any available web front-end to access them as well, including any provided by an application server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文