1、在pom.xml中添加依赖
<!-- 全局热部署依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
2、开启idea自编译
file==》setting==》compiler==》勾选Build project automatically
3、开启允许程序交换类加载器
Ctrl+Alt+Shit+/ ==》选择Register ==》勾选compiler.automake.allow.when.app.running ==》close