springboot热部署
springboot热部署的本质是重启项目,因为是虚拟机启动,所以速度比较快!
操作如下:
-
pom配置
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin> </plugins>
-
配置文件修改,以application.properties为例
//开启热部署 spring.devtools.restart.enabled=true //设置热部署的范围 spring.devtools.restart.additional-paths=src/main/java
-
idea实现热部署,还需要自身设置
File->Setting->Compiler->Build project automatically(勾选) ctrl + shift + alt + /->Registry->Compiler autoMake allow when app running(勾选)