「ResourceBundleMessageSource」を使用するようにSpring構成xmlを構成しました。リソースバンドルファイルからメッセージを取得しようとしていますが、実行中に次のようなログが表示されます:指定されたリソースバンドルが見つかりませんでした名前。
より正確には:
WARN org.springframework.context.support.ResourceBundleMessageSource - ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en_US
spring.xml の構成
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean>
私のコードで使用しようとしている方法:
ResourceBundleMessageSource rbms = (ResourceBundleMessageSource) applicationCtx.getBean("messageSource");
String message = rbms.getMessage("key001", parameters,"default message", null);
そして、messages.properties の一部 (このファイルを project/src/ の下に置きました)
key001 = Problem occurred while fetching the results from database. Please see log.
私もmessages_en_US.properitesでファイルの名前を変更しようとしましたが、役に立ちませんでした。
何か不足していますか?
前もって感謝します。