diff --git a/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java b/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java index 9362ac7875..ae0b4f5fb1 100644 --- a/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java +++ b/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java @@ -32,7 +32,7 @@ import org.springframework.util.Assert; * @since 3.0 * @see org.springframework.context.ApplicationListener#onApplicationEvent */ -public class GenericApplicationListenerAdapter implements GenericApplicationListener { +public class GenericApplicationListenerAdapter implements GenericApplicationListener, SmartApplicationListener { private final ApplicationListener delegate; @@ -67,6 +67,11 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList } } + @Override + public boolean supportsEventType(Class eventType) { + return supportsEventType(ResolvableType.forType(eventType)); + } + @Override public boolean supportsSourceType(Class sourceType) { if (this.delegate instanceof SmartApplicationListener) { diff --git a/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java b/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java index 6143b48483..21a4b4c7a0 100644 --- a/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java +++ b/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java @@ -33,7 +33,7 @@ import org.springframework.core.ResolvableType; * @author Stephane Nicoll * @since 2.0.5 */ -public class SourceFilteringListener implements GenericApplicationListener { +public class SourceFilteringListener implements GenericApplicationListener, SmartApplicationListener { private final Object source; @@ -77,6 +77,11 @@ public class SourceFilteringListener implements GenericApplicationListener { return (this.delegate == null || this.delegate.supportsEventType(eventType)); } + @Override + public boolean supportsEventType(Class eventType) { + return supportsEventType(ResolvableType.forType(eventType)); + } + @Override public boolean supportsSourceType(Class sourceType) { return (sourceType != null && sourceType.isInstance(this.source));