Add ApplicationReadyEvent

Add an event that indicates the Spring Application has fully started and
is now ready to service requests. While ContextRefreshEvent provides
such hook for a regular spring application, this dedicated event is
triggered once all callbacks have been processed and right before the
context is returned to the caller. Besides, such event is triggered once
per application, regardless of the number of (child) contexts that could
have been created.

Closes gh-2638
This commit is contained in:
Stephane Nicoll
2015-03-12 09:19:13 +01:00
parent bfee98e1f3
commit 7b2b11903a
4 changed files with 101 additions and 1 deletions

View File

@@ -151,6 +151,8 @@ Application events are sent in the following order, as your application runs:
the context is known, but before the context is created.
. An `ApplicationPreparedEvent` is sent just before the refresh is started, but after bean
definitions have been loaded.
. An `ApplicationReadyEvent` is sent after the refresh and any related callbacks have
been processed to indicate the application is ready to service requests.
. An `ApplicationFailedEvent` is sent if there is an exception on startup.
TIP: You often won't need to use application events, but it can be handy to know that they