Skip to content

Add ApplicationReadyEvent #2638

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

Closed
snicoll opened this issue Mar 12, 2015 · 4 comments
Closed

Add ApplicationReadyEvent #2638

snicoll opened this issue Mar 12, 2015 · 4 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Mar 12, 2015

Such event may be useful for listeners that requires to perform the operation when the application is ready to use. Would be triggered right before returning the ApplicationContext from the run method.

@snicoll snicoll added the type: enhancement A general enhancement label Mar 12, 2015
@snicoll snicoll self-assigned this Mar 12, 2015
@snicoll snicoll added this to the 1.3.0 milestone Mar 12, 2015
@philwebb philwebb reopened this Mar 16, 2015
@philwebb
Copy link
Member

I think ApplicationReadyEvent should probably extend SpringApplicationEvent so that it has parity with ApplicationFailedEvent. We've probably also got a package tangle now, so we should trigger it from EventPublishingRunListener.finished() rather than directly from SpringApplication.

@philwebb
Copy link
Member

Also, is there a specific use-case where this is needed over a ContextRefreshedEvent?

@snicoll
Copy link
Member Author

snicoll commented Mar 17, 2015

In the reference issue. The maven plugin listens to it to let the integration tests run.

I disagree with it extending SpringApplicationEvent. This is what I did initially but semantically it does not fit: when you handle that event, the SpringApplication has been "fully loaded" and any attempt to modify it (call a setter, register a listener) will just not do what you expect. I think the application context is a much better source in that regard.

Good catch for the cycle.

@philwebb
Copy link
Member

I think having context of which SpringApplication triggered the event is still useful. We also have precedence with ApplicationPreparedEvent.

snicoll added a commit to snicoll/spring-boot that referenced this issue Mar 20, 2015
Rework 7b2b119 so that it is more aligned with others spring
application events. Fix the package tangle by moving the publication part
to EventPublishingRunListener.

Closes spring-projectsgh-2638
philwebb added a commit that referenced this issue Mar 23, 2015
Update ApplicationReadyEvent to also include the ApplicationContext.

See gh-2638
@wilkinsona wilkinsona modified the milestones: 1.3.0, 1.3.0.M1 May 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants