Skip to content

Commit 11e7ac1

Browse files
authored
Update 20.2 Automatic restart.md
1 parent 918461f commit 11e7ac1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

III. Using Spring Boot/20.2 Automatic restart.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,13 @@
1818
</plugins>
1919
</build>
2020
```
21+
自动重启跟LiveReload可以一起很好的工作,具体参考[下面章节](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-devtools-livereload)。如果你使用JRebel,自动重启将禁用以支持动态类加载,其他devtools特性,比如LiveReload,属性覆盖仍旧可以使用。
2122

23+
DevTools依赖应用上下文的shutdown钩子来关闭处于重启过程的应用,如果禁用shutdown钩子(`SpringApplication.setRegisterShutdownHook(false)`),它将不能正常工作。
24+
25+
当判定classpath下实体的改变是否会触发重启时,DevTools自动忽略以下工程:`spring-boot``spring-boot-devtools``spring-boot-autoconfigure``spring-boot-actuator``spring-boot-starter`
26+
27+
**Restart vs Reload** Spring Boot提供的重启技术是通过使用两个类加载器实现的。没有变化的类(比如那些第三方jars)会加载进一个基础(basic)classloader,正在开发的类会加载进一个重启(restart)classloader。当应用重启时,restart类加载器会被丢弃,并创建一个新的。这种方式意味着应用重启通常比冷启动(cold starts)快很多,因为基础类加载器已经可用,并且populated(意思是基础类加载器加载的类比较多?)。
28+
29+
如果发现重启对于你的应用来说不够快,或遇到类加载的问题,那你可以考虑reload技术,比如[JRebel](http://zeroturnaround.com/software/jrebel/),这些技术是通过重写它们加载过的类实现的。[Spring Loaded](https://github.com/spring-projects/spring-loaded)提供了另一种选择,然而很多框架不支持它,也得不到商业支持。
2230

0 commit comments

Comments
 (0)