这是 1.6.1 的 Spring Framework Core 的一个片段:生命周期回调:
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.
什么是热刷新?跟live reloading有关系吗?
最佳答案
我自己回答问题。
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.
它是在不重启应用程序的情况下替换其配置位置属性的 Web 应用程序上下文。
关于java - 什么是热刷新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57834139/