While working on #35168, I noticed that there is currently no way to differentiate between an ApplicationContext
start
and restart
in terms of events.
This is due to the fact that a ContextStartedEvent
is fired for both AbstractApplicationContext.start()
and AbstractApplicationContext.restart()
.
Thus, to assist developers who may wish to differentiate between start
and restart
events, we should introduce a new ContextRestartedEvent
as a subtype of ContextStartedEvent
.
By making ContextRestartedEvent
a subtype of ContextStartedEvent
, applications can still expect ContextStoppedEvent
/ContextStartedEvent
event pairs for consistent lifecycle semantics, and they can optionally check if the ContextStartedEvent
is a ContextRestartedEvent
. Alternatively, applications can explicitly react to a ContextRestartedEvent
.
Related Issues
-
35168
-
35171