1 在pom.xml 中 配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
2 idea开启自动编译
command + shift + a 勾选 “compiler.automake.allow.when.app.running” 。