是否可以在.war中的属性文件上写入? [英] Is it possible to write on a properties file inside a .war?
问题描述
我看到很多如何读取文件或找到它,但我一直在尝试运行Properties.store(),而且它很简单,不会修改文件。
I see a lot of how to read the file or locate it, but I've been trying to run Properties.store() and it simple does not modify the file.
我可以读取,获取和设置属性,但存储不起作用。它应该工作还是不工作?
I can read, get and set properties but store doesn't work. Should it work or is not meant to work?
如果它不起作用,我该如何修改文件,所以当服务器重启时这些属性不会丢失?
If it doesn't work, how can I modify the file, so when the server restart those properties do not get lost?
推荐答案
否;它在WAR内部。
从技术上讲,你可以解压缩它,修改它,将它拉回来。但请不要。
Technically you could un-zip it, modify it, zip it back up. But don't.
这样的属性应存储在数据库,JNDI或战争之外的文件中。
Properties like that should be stored in a DB, in JNDI, or in a file outside of the war.
这篇关于是否可以在.war中的属性文件上写入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!