官方地址:https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#using-boot-devtools
Maven配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
不被热部署的文件
- /META-INF/maven, /META-INF/resources, /resources, /static, /public, or /templates
指定文件不进行热部署
#指定某些文件不进行监听,即不会进行热加载
spring.devtools.restart.exclude=example.txt
- 在application.properties中这样配置后,修改example.txt将不会进行热更新。
手工触发重启
#通过触发器,去控制什么时候进行热加载部署新的文件
spring.devtools.restart.trigger-file=trigger.txt
- 在application.properties中这样配置后,除了修改trigger.txt文件,不然不进行热部署。
- 这种方法很适合开发,我们可以根据自己的需求决定什么时候进行热更新加载。