From bf2790498bc6be08d16fc12f1fe02666e123b488 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Tue, 13 Jul 2021 13:43:03 +0200 Subject: [PATCH] Document ResourceBundle limitations This commit adds a note to the documentation saying that ResourceBundle does not support multiple bundles with the same base name. Closes gh-27038 --- src/docs/asciidoc/core/core-beans.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc index 630a4b0dbd88..487ef6f4a1ea 100644 --- a/src/docs/asciidoc/core/core-beans.adoc +++ b/src/docs/asciidoc/core/core-beans.adoc @@ -10406,6 +10406,10 @@ You can also use the `MessageSourceAware` interface to acquire a reference to an `ApplicationContext` that implements the `MessageSourceAware` interface is injected with the application context's `MessageSource` when the bean is created and configured. +NOTE: Because Spring's `MessageSource` is based on Java's `ResourceBundle`, it does not merge +bundles with the same base name, but will only use the first bundle found. +Subsequent message bundles with the same base name are ignored. + NOTE: As an alternative to `ResourceBundleMessageSource`, Spring provides a `ReloadableResourceBundleMessageSource` class. This variant supports the same bundle file format but is more flexible than the standard JDK based