SpringBoot2.x使用Dev-tool热部署

什么是热部署,使用springboot结合dev-tool工具,快速加载启动应用

1.核心依赖包:
        <dependency>  
             <groupId>org.springframework.boot</groupId>  
             <artifactId>spring-boot-devtools</artifactId>  
             <optional>true</optional>  
         </dependency>
    添加依赖后,在ide里面重启应用,后续修改后马上可以生效

2.    不被热部署的文件
         1、/META-INF/maven, /META-INF/resources, /resources, /static, /public, or /templates
         2、指定文件不进行热部署 spring.devtools.restart.exclude=static/**,public/**

3.手工触发重启 spring.devtools.restart.trigger-file=trigger.txt
             改代码不重启,通过一个文本去控制

在application.properties

spring.devtools.restart.trigger-file=restart.trigger

然后在resource目录下增加了restart.trigger文件

需要在修改类后,再修改一下restart.trigger才会触发重启。

猜你喜欢

转载自blog.csdn.net/peng_0129/article/details/84974990