diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractResourceBasedMessageSource.java b/spring-context/src/main/java/org/springframework/context/support/AbstractResourceBasedMessageSource.java
index 37ffa85e40..0d633af007 100644
--- a/spring-context/src/main/java/org/springframework/context/support/AbstractResourceBasedMessageSource.java
+++ b/spring-context/src/main/java/org/springframework/context/support/AbstractResourceBasedMessageSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,6 +110,7 @@ public abstract class AbstractResourceBasedMessageSource extends AbstractMessage
* in the order of registration.
*
Calling code may introspect this set as well as add or remove entries.
* @since 4.3
+ * @see #setBasenames
* @see #addBasenames
*/
public Set getBasenameSet() {
diff --git a/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java b/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java
index 1f5154ffd5..4d596fddb5 100644
--- a/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java
+++ b/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java
@@ -250,16 +250,15 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
* Only used when caching resource bundle contents forever, i.e.
* with cacheSeconds < 0. Therefore, merged properties are always
* cached forever.
+ * @see #collectPropertiesToMerge
+ * @see #mergeProperties
*/
protected PropertiesHolder getMergedProperties(Locale locale) {
PropertiesHolder mergedHolder = this.cachedMergedProperties.get(locale);
if (mergedHolder != null) {
return mergedHolder;
}
-
- List holders = collectPropertiesToMerge(locale);
-
- mergedHolder = merge(holders);
+ mergedHolder = mergeProperties(collectPropertiesToMerge(locale));
PropertiesHolder existing = this.cachedMergedProperties.putIfAbsent(locale, mergedHolder);
if (existing != null) {
mergedHolder = existing;
@@ -267,6 +266,15 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
return mergedHolder;
}
+ /**
+ * Determine the properties to merge based on the specified basenames.
+ * @param locale the locale
+ * @return the list of properties holders
+ * @since 6.1.4
+ * @see #getBasenameSet()
+ * @see #calculateAllFilenames
+ * @see #mergeProperties
+ */
protected List collectPropertiesToMerge(Locale locale) {
String[] basenames = StringUtils.toStringArray(getBasenameSet());
List holders = new ArrayList<>(basenames.length);
@@ -283,7 +291,16 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
return holders;
}
- protected PropertiesHolder merge(List holders) {
+ /**
+ * Merge the given properties holders into a single holder.
+ * @param holders the list of properties holders
+ * @return a single merged holder
+ * @since 6.1.4
+ * @see #newProperties()
+ * @see #getMergedProperties
+ * @see #collectPropertiesToMerge
+ */
+ protected PropertiesHolder mergeProperties(List holders) {
Properties mergedProps = newProperties();
long latestTimestamp = -1;
for (PropertiesHolder holder : holders) {