diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index 9748cbf39b0..1776bac9dc6 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -46,9 +46,9 @@ import org.springframework.boot.env.EnvironmentPostProcessor; import org.springframework.boot.env.PropertySourcesLoader; import org.springframework.boot.logging.DeferredLog; import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ConfigurationClassPostProcessor; +import org.springframework.context.event.SmartApplicationListener; import org.springframework.core.Ordered; import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.core.convert.ConversionService; @@ -102,7 +102,7 @@ import org.springframework.validation.BindException; * @author EddĂș MelĂ©ndez */ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, - ApplicationListener, Ordered { + SmartApplicationListener, Ordered { private static final String DEFAULT_PROPERTIES = "defaultProperties"; @@ -151,6 +151,17 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, private final ConversionService conversionService = new DefaultConversionService(); + @Override + public boolean supportsEventType(Class eventType) { + return ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType) || + ApplicationPreparedEvent.class.isAssignableFrom(eventType); + } + + @Override + public boolean supportsSourceType(Class aClass) { + return true; + } + @Override public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) {