第一步:在pom.xml增加下面依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.3.4.RELEASE</version>
<optional>true</optional>
</dependency>
<dependencies>
<!-- spring热部署 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
</dependencies>
第二步:打开idea ,File->Settings-> Build-Execution-Deployment -> Compiler,勾选 Build Project Automatically
第三步: 按 Shift+Ctrl+A (windows,mac是 command+shift+A),将看到弹窗 Enter Action or option name,输入"registry",双击第一项"Registry..." ,会弹出另一个窗口,寻找compiler.automake.allow.when.app.running这一项,并勾选开启。然后关闭窗口
第四步:重启IDEA。