@@ -517,7 +517,6 @@ void replyWithPayload() {
517
517
ReplyEventListener replyEventListener = this .context .getBean (ReplyEventListener .class );
518
518
TestEventListener listener = this .context .getBean (TestEventListener .class );
519
519
520
-
521
520
this .eventCollector .assertNoEventReceived (listener );
522
521
this .eventCollector .assertNoEventReceived (replyEventListener );
523
522
this .context .publishEvent (event );
@@ -634,6 +633,17 @@ void orderedListeners() {
634
633
assertThat (listener .order ).contains ("first" , "second" , "third" );
635
634
}
636
635
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
+
637
647
@ Test @ Disabled // SPR-15122
638
648
void listenersReceiveEarlyEvents () {
639
649
load (EventOnPostConstruct .class , OrderedTestListener .class );
@@ -646,7 +656,7 @@ void listenersReceiveEarlyEvents() {
646
656
void missingListenerBeanIgnored () {
647
657
load (MissingEventListener .class );
648
658
context .getBean (UseMissingEventListener .class );
649
- context .getBean ( ApplicationEventMulticaster . class ). multicastEvent (new TestEvent (this ));
659
+ context .publishEvent (new TestEvent (this ));
650
660
}
651
661
652
662
@@ -753,7 +763,6 @@ static class ContextEventListener extends AbstractTestEventListener {
753
763
public void handleContextEvent (ApplicationContextEvent event ) {
754
764
collectEvent (event );
755
765
}
756
-
757
766
}
758
767
759
768
@@ -979,7 +988,6 @@ public void handleString(GenericEventPojo<String> value) {
979
988
}
980
989
981
990
982
-
983
991
@ EventListener
984
992
@ Retention (RetentionPolicy .RUNTIME )
985
993
public @interface ConditionalEvent {
@@ -1031,7 +1039,7 @@ public void handleRatio(Double ratio) {
1031
1039
}
1032
1040
1033
1041
1034
- @ Configuration
1042
+ @ Component
1035
1043
static class OrderedTestListener extends TestEventListener {
1036
1044
1037
1045
public final List <String > order = new ArrayList <>();
@@ -1055,6 +1063,11 @@ public void handleSecond(String payload) {
1055
1063
}
1056
1064
1057
1065
1066
+ @ Component
1067
+ public static class PublicSubclassWithInheritedEventListener extends TestEventListener {
1068
+ }
1069
+
1070
+
1058
1071
static class EventOnPostConstruct {
1059
1072
1060
1073
@ Autowired
0 commit comments