From 8540bc0d121e1af98fb1d42749fe53f51e548df5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 14 Jul 2021 18:01:34 +0100 Subject: [PATCH] Polish restoration of ConfigFileApplicationListener See gh-27303 --- .../boot/context/config/ConfigDataEnvironmentPostProcessor.java | 2 ++ .../context/config/ConfigDataEnvironmentPostProcessorTests.java | 1 + .../boot/context/config/ConfigFileApplicationListenerTests.java | 1 + 3 files changed, 4 insertions(+) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java index a403c36e58..7df92a2548 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java @@ -129,6 +129,7 @@ public class ConfigDataEnvironmentPostProcessor implements EnvironmentPostProces getLegacyListener().addPropertySources(environment, resourceLoader); } + @SuppressWarnings("deprecation") LegacyConfigFileApplicationListener getLegacyListener() { return new LegacyConfigFileApplicationListener(this.logFactory.getLog(ConfigFileApplicationListener.class)); } @@ -200,6 +201,7 @@ public class ConfigDataEnvironmentPostProcessor implements EnvironmentPostProces postProcessor.postProcessEnvironment(environment, resourceLoader, additionalProfiles); } + @SuppressWarnings("deprecation") static class LegacyConfigFileApplicationListener extends ConfigFileApplicationListener { LegacyConfigFileApplicationListener(Log logger) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java index 8afd11dbbc..585e0dd84a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java @@ -71,6 +71,7 @@ class ConfigDataEnvironmentPostProcessorTests { private ArgumentCaptor resourceLoaderCaptor; @Test + @Deprecated void defaultOrderMatchesDeprecatedListener() { assertThat(ConfigDataEnvironmentPostProcessor.ORDER).isEqualTo(ConfigFileApplicationListener.DEFAULT_ORDER); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 69743d919b..9040a27782 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -72,6 +72,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; * @author Scott Frederick * @author Nguyen Bao Sach */ +@Deprecated @ExtendWith({ OutputCaptureExtension.class, UseLegacyProcessing.class }) class ConfigFileApplicationListenerTests {