在运行项目过程中,难免会出错,要修改代码就必须关闭项目重新启动。这样子很麻烦,SpringBoot 提供了热部署功能,在不用重启项目的前提下,编辑完代码会自动编译。
需要引入2个依赖包
pom.xml
<!-- 热部署依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-loader</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>