1.pom.xml文件中引入热部署依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
2.设置项目自动构建
设置路径(快捷键Ctrl+Alt+S):File -> Settings -> Build, Execution, Deployment -> Compiler
3.允许项目启动时自动构建
设置路径:打开maintenance面板(快捷键Crtl+Alt+Shift+/) -> 选择[1. Registry...] -> 勾选[compiler.automake.allow.when.app.running]
4.重新启动IDEA(稳妥起见)
如果没有生效,请尝试清缓存刷新。Chrome浏览器快捷键Ctrl+F5