java - 什么是热刷新?

标签 java spring

这是 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 the ApplicationContext is initialized or refreshed (for example, by using the refresh() method on the ConfigurableApplicationContext interface). Here, “initialized” means that all beans are loaded, post-processor beans are detected and activated, singletons are pre-instantiated, and the ApplicationContext object is ready for use. As long as the context has not been closed, a refresh can be triggered multiple times, provided that the chosen ApplicationContext actually supports such “hot” refreshes. For example, XmlWebApplicationContext supports hot refreshes, but GenericApplicationContext 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/

相关文章:

java - 如何在二次筛技术的筛分步骤中使用对数

java - Spring 和 Hibernate 的延迟加载

java - 升级到 JAVA 8 后 Threadlocal 在 tomcat 上的不当行为

java - Libgdx Box2D - 在 body 上绘制 Sprite - 严重问题

java - Spring范围请求哈希码

java - 通过 WebApplicationContext 访问 Filter 对象

java - Spring - 如何在 View 之间传递消息?

java - 只读类/方法

java - Hibernate DAO/SessionFactory 使用

java - 如何将 Java 字符串传递给 JSP 页面中的 JavaScript 函数