Description
František Hartman opened SPR-15122 and commented
Annotation-based event listener does not receive event published in @PostConstruct
, while old style interface based listener does.
See example project at https://github.com/frant-hartm/spring-application-events
One event is published in @PostConstruct
method of another bean. Another event is published from main method after context is initialised. Interface based listener sees both events, annotation based sees only the second one:
Interface based sees event: MyEvent{value='from postConstruct'}
Annotation based sees event: MyEvent{value='from main'}
Interface based sees event: MyEvent{value='from main'}
Affects: 4.3.5
Reference URL: https://github.com/frant-hartm/spring-application-events
Issue Links:
- ApplicationListener-like annotation for consuming application events [SPR-11622] #16245 ApplicationListener-like annotation for consuming application events
- Revisit "ApplicationEventMulticaster not initialized" behavior for early event publication scenarios [SPR-12902] #17501 Revisit "ApplicationEventMulticaster not initialized" behavior for early event publication scenarios
- Introduce API to select application listeners [SPR-15441] #20002 Introduce API to select application listeners