应用程序运行时消息包存储在哪里(内存或磁盘)



我正在使用JAVA Struts2。我正在使用 ActionSupport 的 getText() 读取属性文件(由 struts2 提供)。

它们作为java.util.ResourceBundle实例存储在XWork核心库LocalizedTextUtil的静态ConcurrentMap中。

默认情况下,资源包缓存在内存中。

默认情况下,它存储在内存中。 但是,如果要让框架检查每次查找的属性文件,则可以这样做。 这对发展来说是一件好事。

您可以在struts.properties文件中配置此类内容。 以下内容来自 struts-default.properties ,它用作此类配置的注释样板。

### when set to true, Struts will act much more friendly for developers. This
### includes:
### - struts.i18n.reload = true
### - struts.configuration.xml.reload = true
### - raising various debug or ignorable problems to errors
###   For example: normally a request to foo.action?someUnknownField=true should
###                be ignored (given that any value can come from the web and it
###                should not be trusted). However, during development, it may be
###                useful to know when these errors are happening and be told of
###                them right away.
struts.devMode = false
### when set to true, resource bundles will be reloaded on _every_ request.
### this is good during development, but should never be used in production
struts.i18n.reload=false

将这两个属性中的任何一个设置为WEB-INF/classes/struts.properties文件中的true将使框架从物理属性文件加载以进行每次查找。

最新更新