question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApplicationReadyEvent fires multiple time while using SpringApplicationBuilder

See original GitHub issue

Using ApplicationListener<ApplicatioReadyEvent> with the usage of SpringApplicationBuilder fires multiple notification to that listener (for every child). Please have a look to that small demonstration: demo.zip

Issue created after stackoverflow question comment: here

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
snicollcommented, Apr 14, 2017

Regardless I think we should fix it somehow. If we agree the scope of the application is independent of the structure of the application context, then we should fire it only once and at the appropriate time. Not sure however that everybody share the same concept of “application” (perhaps the builder is used to start several apps in isolation in child context?).

0reactions
garyrussellcommented, Oct 13, 2017

i.e. we already perform ApplicationContextAware injection for ApplicationListener

Doh - I didn’t notice that code. I guess I am ok with not doing auto wiring - agreed that doco is probably enough at this point.

That said, I am sure I would only use this feature when interested with those “early” events and use a @Bean for a “proper” listener.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot 2 - Do something before the beans are initialized
This will focus on problem of how to run some code before the classes are initialized as beans and put into Spring IoC...
Read more >
Core Features - Spring
An ApplicationReadyEvent is sent after any application and command-line runners have been called. An AvailabilityChangeEvent is sent right after with ...
Read more >
Spring Boot Application Events Explained - Reflectoring
An ApplicationFailedEvent is fired if there is an exception and the application fails to start. This can happen at any time during startup....
Read more >
Spring Boot Reference Guide
In those cases, see the section called “Using Spring Boot ... The SpringApplicationBuilder lets you chain together multiple method calls and includes parent....
Read more >
Changes since Spring Boot 1.x - Packt Subscription
These are the most notable changes, but there are so many more, as with any ... Boot application bootstrapping with a tool called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found