|
46 | 46 | import org.springframework.boot.env.PropertySourcesLoader;
|
47 | 47 | import org.springframework.boot.logging.DeferredLog;
|
48 | 48 | import org.springframework.context.ApplicationEvent;
|
49 |
| -import org.springframework.context.ApplicationListener; |
50 | 49 | import org.springframework.context.ConfigurableApplicationContext;
|
51 | 50 | import org.springframework.context.annotation.ConfigurationClassPostProcessor;
|
| 51 | +import org.springframework.context.event.SmartApplicationListener; |
52 | 52 | import org.springframework.core.Ordered;
|
53 | 53 | import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
54 | 54 | import org.springframework.core.convert.ConversionService;
|
|
62 | 62 | import org.springframework.core.io.Resource;
|
63 | 63 | import org.springframework.core.io.ResourceLoader;
|
64 | 64 | import org.springframework.core.io.support.SpringFactoriesLoader;
|
| 65 | +import org.springframework.lang.Nullable; |
65 | 66 | import org.springframework.util.Assert;
|
66 | 67 | import org.springframework.util.ResourceUtils;
|
67 | 68 | import org.springframework.util.StringUtils;
|
|
102 | 103 | * @author Eddú Meléndez
|
103 | 104 | */
|
104 | 105 | public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
|
105 |
| - ApplicationListener<ApplicationEvent>, Ordered { |
| 106 | + SmartApplicationListener, Ordered { |
106 | 107 |
|
107 | 108 | private static final String DEFAULT_PROPERTIES = "defaultProperties";
|
108 | 109 |
|
@@ -276,6 +277,17 @@ public void setSearchNames(String names) {
|
276 | 277 | this.names = names;
|
277 | 278 | }
|
278 | 279 |
|
| 280 | + @Override |
| 281 | + public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { |
| 282 | + return ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType) || |
| 283 | + ApplicationPreparedEvent.class.isAssignableFrom(eventType); |
| 284 | + } |
| 285 | + |
| 286 | + @Override |
| 287 | + public boolean supportsSourceType(@Nullable Class<?> aClass) { |
| 288 | + return true; |
| 289 | + } |
| 290 | + |
279 | 291 | /**
|
280 | 292 | * {@link BeanFactoryPostProcessor} to re-order our property sources below any
|
281 | 293 | * {@code @PropertySource} items added by the {@link ConfigurationClassPostProcessor}.
|
|
0 commit comments