引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
修改idea配置
1、快捷键Ctrl+Alt+Shift+/
,选中compiler.automake.allow.when.app.running
2、打开settings-compiler,勾选Build project automatically