Reputation:
Here is a snippet from Spring Framework Core from 1.6.1: Lifecycle Callbacks:
Also, please note that stop notifications are not guaranteed to come before destruction. On regular shutdown, all
Lifecycle
beans first receive a stop notification before the general destruction callbacks are being propagated. However, on hot refresh during a context’s lifetime or on aborted refresh attempts, only destroy methods are called.
What is hot refresh? Does it have something to do with live reloading?
Upvotes: 3
Views: 950
Reputation:
Answering question by myself.
ContextRefreshedEvent
is published when theApplicationContext
is initialized or refreshed (for example, by using therefresh()
method on theConfigurableApplicationContext
interface). Here, “initialized” means that all beans are loaded, post-processor beans are detected and activated, singletons are pre-instantiated, and theApplicationContext
object is ready for use. As long as the context has not been closed, a refresh can be triggered multiple times, provided that the chosenApplicationContext
actually supports such “hot” refreshes. For example,XmlWebApplicationContext
supports hot refreshes, butGenericApplicationContext
does not.
AbstractRefreshableWebApplicationContext
:
Provides a "configLocations" property, to be populated through the
ConfigurableWebApplicationContext
interface on web application startup.
It is the web application context whose config locations property is being replaced without restarting the app.
Upvotes: 2