java更新属性文件运行时 [英] java update properties file run time

查看:101
本文介绍了java更新属性文件运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为生产监控编写独立的Java应用程序。一旦开始运行,api就会配置为在.properties文件中设置的默认值。在运行状态下,可以更改api的配置,并相应地更新.properties文件。有没有办法实现这个目标?或者有没有其他方法来实现这个?

i am writing standalone java app for production monitoring. once it starts running the api is configured for default values which is set in .properties file. in running state the api's configuration can be changed and the .properties file should be updated accordingly. is there a way to achieve this ? or are there any other approaches to implement this ?

提前致谢

推荐答案

Java Properties类( api here )指定load和store方法,它们应该完全相同。使用FileInputStream和FileOutputStream指定要将其保存到的文件。

The Java Properties class (api here) specifies "load" and "store" methods which should do exactly that. Use FileInputStream and FileOutputStream to specify the file to save it into.

这篇关于java更新属性文件运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆