|
45 | 45 | import org.springframework.boot.env.RandomValuePropertySource;
|
46 | 46 | import org.springframework.boot.logging.DeferredLog;
|
47 | 47 | import org.springframework.context.ApplicationEvent;
|
48 |
| -import org.springframework.context.ApplicationListener; |
49 | 48 | import org.springframework.context.ConfigurableApplicationContext;
|
50 | 49 | import org.springframework.context.annotation.ConfigurationClassPostProcessor;
|
| 50 | +import org.springframework.context.event.SmartApplicationListener; |
51 | 51 | import org.springframework.core.Ordered;
|
52 | 52 | import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
53 | 53 | import org.springframework.core.env.ConfigurableEnvironment;
|
|
93 | 93 | * @author Madhura Bhave
|
94 | 94 | */
|
95 | 95 | public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
|
96 |
| - ApplicationListener<ApplicationEvent>, Ordered { |
| 96 | + SmartApplicationListener, Ordered { |
97 | 97 |
|
98 | 98 | private static final String DEFAULT_PROPERTIES = "defaultProperties";
|
99 | 99 |
|
@@ -140,6 +140,17 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
|
140 | 140 |
|
141 | 141 | private int order = DEFAULT_ORDER;
|
142 | 142 |
|
| 143 | + @Override |
| 144 | + public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { |
| 145 | + return ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType) || |
| 146 | + ApplicationPreparedEvent.class.isAssignableFrom(eventType); |
| 147 | + } |
| 148 | + |
| 149 | + @Override |
| 150 | + public boolean supportsSourceType(Class<?> aClass) { |
| 151 | + return true; |
| 152 | + } |
| 153 | + |
143 | 154 | @Override
|
144 | 155 | public void onApplicationEvent(ApplicationEvent event) {
|
145 | 156 | if (event instanceof ApplicationEnvironmentPreparedEvent) {
|
|
0 commit comments