@@ -517,7 +517,6 @@ void replyWithPayload() {
517517 ReplyEventListener replyEventListener = this .context .getBean (ReplyEventListener .class );
518518 TestEventListener listener = this .context .getBean (TestEventListener .class );
519519
520-
521520 this .eventCollector .assertNoEventReceived (listener );
522521 this .eventCollector .assertNoEventReceived (replyEventListener );
523522 this .context .publishEvent (event );
@@ -634,6 +633,17 @@ void orderedListeners() {
634633 assertThat (listener .order ).contains ("first" , "second" , "third" );
635634 }
636635
636+ @ Test
637+ void publicSubclassWithInheritedEventListener () {
638+ load (PublicSubclassWithInheritedEventListener .class );
639+ TestEventListener listener = this .context .getBean (PublicSubclassWithInheritedEventListener .class );
640+
641+ this .eventCollector .assertNoEventReceived (listener );
642+ this .context .publishEvent ("test" );
643+ this .eventCollector .assertEvent (listener , "test" );
644+ this .eventCollector .assertTotalEventsCount (1 );
645+ }
646+
637647 @ Test @ Disabled // SPR-15122
638648 void listenersReceiveEarlyEvents () {
639649 load (EventOnPostConstruct .class , OrderedTestListener .class );
@@ -646,7 +656,7 @@ void listenersReceiveEarlyEvents() {
646656 void missingListenerBeanIgnored () {
647657 load (MissingEventListener .class );
648658 context .getBean (UseMissingEventListener .class );
649- context .getBean ( ApplicationEventMulticaster . class ). multicastEvent (new TestEvent (this ));
659+ context .publishEvent (new TestEvent (this ));
650660 }
651661
652662
@@ -753,7 +763,6 @@ static class ContextEventListener extends AbstractTestEventListener {
753763 public void handleContextEvent (ApplicationContextEvent event ) {
754764 collectEvent (event );
755765 }
756-
757766 }
758767
759768
@@ -979,7 +988,6 @@ public void handleString(GenericEventPojo<String> value) {
979988 }
980989
981990
982-
983991 @ EventListener
984992 @ Retention (RetentionPolicy .RUNTIME )
985993 public @interface ConditionalEvent {
@@ -1031,7 +1039,7 @@ public void handleRatio(Double ratio) {
10311039 }
10321040
10331041
1034- @ Configuration
1042+ @ Component
10351043 static class OrderedTestListener extends TestEventListener {
10361044
10371045 public final List <String > order = new ArrayList <>();
@@ -1055,6 +1063,11 @@ public void handleSecond(String payload) {
10551063 }
10561064
10571065
1066+ @ Component
1067+ public static class PublicSubclassWithInheritedEventListener extends TestEventListener {
1068+ }
1069+
1070+
10581071 static class EventOnPostConstruct {
10591072
10601073 @ Autowired
0 commit comments