第一步:添加devtools依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
要确保依赖成功导入
第二步,打开设置(ctrl+alt+s),搜索Compiler勾选上Build project automatically