热部署:修改源文件后,不用重启服务器
目录
Build,execution,Deployment---Complier---
ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running
一:导包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional><!--当前这个项目被继承之后,这个不向下传递-->
<scope>runtime</scope>
</dependency>
二:修改pom里的<build>配置
三:idea设置
Build,execution,Deployment---Complier---
ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running
四: 全局配置文件配置
#修改即时生效
spring:
devtools: # 热部署配置
restart:
enabled: true #设置开启热部署
additional-paths: src/main/java #设置重启的目录,添加目录的文件需要restart
poll-interval: 3000 #解决项目自动重新编译后接口报404的问题
quiet-period: 1000
thymeleaf:
cache: false #页面不加载缓存,
五:效果
修改文件按crlt+f9就行,不需要重启服务器