我正在使用JAVA Struts2。我正在使用ActionSupport的getText()(由struts2提供)来读取属性文件。
答案 0 :(得分:2)
它们作为java.util.ResourceBundle
实例存储在XWork核心库中ConcurrentMap
的静态LocalizedTextUtil
中。
默认情况下,ResourceBundles缓存在内存中。
答案 1 :(得分:2)
默认情况下,它存储在内存中。但是如果你想让框架检查每个查找的属性文件,你可以这样做。这对开发来说是件好事。
您可以在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
在true
文件中将这两个属性中的任何一个设置为WEB-INF/classes/struts.properties
将使每个查找的physcial属性文件加载框架。