基于IDEA的热部暑
在pom中引入devtools
org.springframework.boot
spring-boot-devtools
true
然后在application.properties中进行配置
#关闭缓存, 即时刷新
#spring.freemarker.cache=false
spring.thymeleaf.cache=true
#热部署生效
spring.devtools.restart.enabled=true
#设置重启的目录,添加那个目录的文件需要restart
spring.devtools.restart.additional-paths=src/main/java
# 排除那个目录的文件不需要restart
#spring.devtools.restart.exclude=static/**,public/**
#classpath目录下的WEB-INF文件夹内容修改不重启
#spring.devtools.restart.exclude=WEB-INF/**
在IDEA的设置有两个地方要勾上的
1, 第一个位置: file - settings - compiler
image.png
按ctrl+shift+alt+/ 后出现下图(2.1), 选择registry 然后在如2.2图中找到 compiler.automake.allow.when.app.runing 勾上
图2.1
图2.2
配置完成 ~