pom.xml文件下添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
idea设置自动编译
image.png
idea 设置运行时自动编译command + shift + A
输入Registry
选择第一个
image.png
然后找到下图选项打勾
image.png