简体   繁体   English

是否可以在.war内的属性文件上写?

[英]Is it possible to write on a properties file inside a .war?

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. 我看到了很多有关如何读取或定位文件的方法,但是我一直在尝试运行Properties.store(),它简单地不会修改文件。

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? 如果不起作用,该如何修改文件,以便服务器重新启动时这些属性不会丢失?

No; 没有; it's inside a WAR. 它在战争中。

Technically you could un-zip it, modify it, zip it back up. 从技术上讲,您可以将其解压缩,修改,再压缩回来。 But don't. 但是不要。

Properties like that should be stored in a DB, in JNDI, or in a file outside of the war. 此类属性应存储在数据库,JNDI或战争之外的文件中。

捆绑在JAR中的属性文件无意更改,因为它们是分发的一部分。

I wouldn't mess with unzipping/rezipping a WAR file, just as a piece of advice. 就像一条建议一样,我不会解压缩WAR文件。 I have done that in the past and it did not work so well. 我过去曾经做过,但效果不是很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM