1. pom文件中添加以下内容
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
2. 勾选setting->Build,Execution,Deployment->Compiler->Build project automatically
3. Ctrl+Shift+Alt+/ -> 选择Registry… -> 勾选compiler.automake.allow.when.app.running
4. 重启项目即可