Skip to content

Commit 26b27d4

Browse files
committed
Polish "Narrow the event types ConfigFileApplicationListener supports"
Closes gh-9628
1 parent d268572 commit 26b27d4

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import org.springframework.core.io.Resource;
6363
import org.springframework.core.io.ResourceLoader;
6464
import org.springframework.core.io.support.SpringFactoriesLoader;
65-
import org.springframework.lang.Nullable;
6665
import org.springframework.util.Assert;
6766
import org.springframework.util.ResourceUtils;
6867
import org.springframework.util.StringUtils;
@@ -152,6 +151,17 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
152151

153152
private final ConversionService conversionService = new DefaultConversionService();
154153

154+
@Override
155+
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
156+
return ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType) ||
157+
ApplicationPreparedEvent.class.isAssignableFrom(eventType);
158+
}
159+
160+
@Override
161+
public boolean supportsSourceType(Class<?> aClass) {
162+
return true;
163+
}
164+
155165
@Override
156166
public void onApplicationEvent(ApplicationEvent event) {
157167
if (event instanceof ApplicationEnvironmentPreparedEvent) {
@@ -277,17 +287,6 @@ public void setSearchNames(String names) {
277287
this.names = names;
278288
}
279289

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-
291290
/**
292291
* {@link BeanFactoryPostProcessor} to re-order our property sources below any
293292
* {@code @PropertySource} items added by the {@link ConfigurationClassPostProcessor}.

0 commit comments

Comments
 (0)