Skip to content

Commit 743782d

Browse files
committed
Revert reloadable message source support
Closes gh-14882 See gh-14699 See gh-13377
1 parent 5ac9b97 commit 743782d

File tree

6 files changed

+1
-67
lines changed

6 files changed

+1
-67
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import org.springframework.context.annotation.ConditionContext;
3434
import org.springframework.context.annotation.Conditional;
3535
import org.springframework.context.annotation.Configuration;
36-
import org.springframework.context.support.AbstractResourceBasedMessageSource;
37-
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
3836
import org.springframework.context.support.ResourceBundleMessageSource;
3937
import org.springframework.core.Ordered;
4038
import org.springframework.core.io.Resource;
@@ -67,9 +65,7 @@ public MessageSourceProperties messageSourceProperties() {
6765

6866
@Bean
6967
public MessageSource messageSource(MessageSourceProperties properties) {
70-
AbstractResourceBasedMessageSource messageSource = (properties.isReloadable()
71-
? new ReloadableResourceBundleMessageSource()
72-
: new ResourceBundleMessageSource());
68+
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
7369
if (StringUtils.hasText(properties.getBasename())) {
7470
messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(
7571
StringUtils.trimAllWhitespace(properties.getBasename())));

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceProperties.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ public class MessageSourceProperties {
7171
*/
7272
private boolean useCodeAsDefaultMessage = false;
7373

74-
/**
75-
* Whether to use a "ReloadableResourceBundleMessageSource" rather than the default
76-
* "ResourceBundleMessageSource". Recommended during development only.
77-
*/
78-
private boolean reloadable = false;
79-
8074
public String getBasename() {
8175
return this.basename;
8276
}
@@ -125,12 +119,4 @@ public void setUseCodeAsDefaultMessage(boolean useCodeAsDefaultMessage) {
125119
this.useCodeAsDefaultMessage = useCodeAsDefaultMessage;
126120
}
127121

128-
public boolean isReloadable() {
129-
return this.reloadable;
130-
}
131-
132-
public void setReloadable(boolean reloadable) {
133-
this.reloadable = reloadable;
134-
}
135-
136122
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
import org.springframework.context.annotation.Bean;
3333
import org.springframework.context.annotation.Configuration;
3434
import org.springframework.context.annotation.PropertySource;
35-
import org.springframework.context.support.DelegatingMessageSource;
36-
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
37-
import org.springframework.context.support.ResourceBundleMessageSource;
3835

3936
import static org.assertj.core.api.Assertions.assertThat;
4037

@@ -223,38 +220,6 @@ public void existingMessageSourceInParentIsIgnored() {
223220
.isEqualTo("bar")));
224221
}
225222

226-
@Test
227-
public void testDefaultReloadableValueMessageSource() {
228-
testReloadableMessageSource(ResourceBundleMessageSource.class,
229-
"spring.messages.basename:test/messages");
230-
}
231-
232-
@Test
233-
public void testNotReloadableMessageSource() {
234-
testReloadableMessageSource(ResourceBundleMessageSource.class,
235-
"spring.messages.basename:test/messages",
236-
"spring.messages.reloadable:false");
237-
}
238-
239-
@Test
240-
public void testReloadableMessageSource() {
241-
testReloadableMessageSource(ReloadableResourceBundleMessageSource.class,
242-
"spring.messages.basename:test/messages",
243-
"spring.messages.reloadable:true");
244-
}
245-
246-
private void testReloadableMessageSource(Class<?> expectedInstance,
247-
String... propertyValues) {
248-
this.contextRunner.withPropertyValues(propertyValues).run((context) -> {
249-
MessageSource messageSource = context.getBean(MessageSource.class);
250-
if (messageSource instanceof DelegatingMessageSource) {
251-
messageSource = ((DelegatingMessageSource) messageSource)
252-
.getParentMessageSource();
253-
}
254-
assertThat(messageSource).isInstanceOf(expectedInstance);
255-
});
256-
}
257-
258223
@Configuration
259224
@PropertySource("classpath:/switch-messages.properties")
260225
protected static class Config {

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
7373
properties.put("server.error.include-stacktrace", "ALWAYS");
7474
properties.put("server.servlet.jsp.init-parameters.development", "true");
7575
properties.put("spring.reactor.stacktrace-mode.enabled", "true");
76-
properties.put("spring.messages.reloadable", "true");
7776
PROPERTIES = Collections.unmodifiableMap(properties);
7877
}
7978

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,6 @@ public void postProcessEnablesIncludeStackTraceProperty() {
114114
.isEqualTo(ErrorProperties.IncludeStacktrace.ALWAYS.toString());
115115
}
116116

117-
@Test
118-
public void postProcessEnablesMessageSourceReloadProperty() {
119-
SpringApplication application = new SpringApplication(TestConfiguration.class);
120-
application.setWebApplicationType(WebApplicationType.NONE);
121-
this.context = application.run();
122-
ConfigurableEnvironment environment = this.context.getEnvironment();
123-
Boolean property = environment.getProperty("spring.messages.reloadable",
124-
Boolean.class);
125-
assertThat(property).isTrue();
126-
}
127-
128117
@Configuration
129118
static class TestConfiguration {
130119

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ content into your application. Rather, pick only the properties that you need.
135135
spring.messages.cache-duration= # Loaded resource bundle files cache duration. When not set, bundles are cached forever. If a duration suffix is not specified, seconds will be used.
136136
spring.messages.encoding=UTF-8 # Message bundles encoding.
137137
spring.messages.fallback-to-system-locale=true # Whether to fall back to the system Locale if no files for a specific Locale have been found.
138-
spring.messages.reloadable=false # Whether to use a "ReloadableResourceBundleMessageSource" rather than the default "ResourceBundleMessageSource". Recommended during development only.
139138
spring.messages.use-code-as-default-message=false # Whether to use the message code as the default message instead of throwing a "NoSuchMessageException". Recommended during development only.
140139
141140
# OUTPUT

0 commit comments

Comments
 (0)