Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationListener is missing from Collection returned by getApplicationListeners() if it was added after the multicaster was initialised [SPR-17324] #21858

Closed
spring-projects-issues opened this issue Oct 2, 2018 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 2, 2018

Andy Wilkinson opened SPR-17324 and commented

In Boot, if context refresh fails, we publish an ApplicationFailedEvent. We can't rely on the context's multicaster being available at this point so we create our own. It is initialised with the collection of listeners returned by AbstractApplicationContext.getApplicationListeners(). Unfortunately, any listeners that were added after the context's multicaster was initialised are missing from this collection so they do not receive the ApplicationFailedEvent.

In AbstractApplicationContext.addApplicationListener(ApplicationListener<?>), would it be possible to always call this.applicationListeners.add(listener) rather than only calling it when this.applicationEventMulticaster is null?


Affects: 5.0.9

Reference URL: spring-projects/spring-boot#14490

Issue Links:

Referenced from: commits c8c0737, d61a7ed

Backported to: 5.0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants