ContextRefreshedEvent class
Published once a context has started: every eager singleton exists and the auto-startup lifecycle beans run.
It is the last step of refresh(). Listen to it for work that needs
the whole application in place, such as warming caches or printing a
"ready" message. In a Spring Boot application, ApplicationReadyEvent
comes later, after the runners, and is usually the better moment. If a
listener throws, the refresh fails (unless the multicaster has an error
handler).
@Component()
@Log()
class Warmup {
@EventListener()
void onReady(ContextRefreshedEvent event) => log.info('ready');
}
Spring (Java):
@EventListener
void onReady(ContextRefreshedEvent event) { ... }
- Inheritance
-
- Object
- ApplicationEvent
- ApplicationContextEvent
- ContextRefreshedEvent
Constructors
- ContextRefreshedEvent(ApplicationContext source)
-
Creates the event for the context
source; contexts do this.
Properties
- applicationContext → ApplicationContext
-
The context that raised the event (the same object as
source, typed).no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → Object
-
The object that raised the event, usually the publishing bean (or
the context, for the context's own events).
finalinherited
- timestamp → DateTime
-
When the event was created (not when a listener receives it).
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited