Skip to content

Commit 1d59e52

Browse files
committed
EventListenerMethodProcessor accepts internal configuration classes
Issue: SPR-17160
1 parent a6a6cf7 commit 1d59e52

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.springframework.lang.Nullable;
4646
import org.springframework.stereotype.Component;
4747
import org.springframework.util.Assert;
48+
import org.springframework.util.ClassUtils;
4849
import org.springframework.util.CollectionUtils;
4950

5051
/**
@@ -196,7 +197,7 @@ private void processBean(final String beanName, final Class<?> targetType) {
196197
*/
197198
private static boolean isSpringContainerClass(Class<?> clazz) {
198199
return (clazz.getName().startsWith("org.springframework.") &&
199-
!AnnotatedElementUtils.isAnnotated(clazz, Component.class));
200+
!AnnotatedElementUtils.isAnnotated(ClassUtils.getUserClass(clazz), Component.class));
200201
}
201202

202203
}

spring-context/src/test/java/org/springframework/context/event/AnnotationDrivenEventListenerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -951,7 +951,7 @@ public void handleRatio(Double ratio) {
951951
}
952952

953953

954-
@Component
954+
@Configuration
955955
static class OrderedTestListener extends TestEventListener {
956956

957957
public final List<String> order = new ArrayList<>();

0 commit comments

Comments
 (0)