导入依赖
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
修改IDEA配置
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/bc9faeec9a123bd447a45ef8aa202f6b.png)
修改Registry,按Ctrl + Shift + A,勾选自动编译选项
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/6b67aba582345c864cb07d742c2d599c.png)
重启启动应用服务后,对代码进行编辑,然后自动保存代码,将会触发自动编译过程。因为Intellij IDEA设置了自动保存,每当你的代码触发了自动保存功能,将会自动重启应用服务。