1

JAVA Struts2 を使用しています。ActionSupport ( struts2 が提供) の getText() を使用してプロパティ ファイルを読み込んでいます。

4

2 に答える 2

2

これらは、XWork コア ライブラリ java.util.ResourceBundleの staticConcurrentMapにインスタンスとして格納されます。LocalizedTextUtil

デフォルトでは、ResourceBundle はメモリにキャッシュされます。

于 2012-09-18T14:37:04.550 に答える
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

これら 2 つのプロパティのいずれかをファイルに設定するとtrueWEB-INF/classes/struts.propertiesルックアップごとにフレームワークが物理プロパティ ファイルから読み込まれます。

于 2012-10-18T19:16:31.720 に答える