1.在pom.xml文件中添加如下配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<!--当前项目的子项目如果不显示依赖该jar包,并不会自动依赖-->
<optional>true</optional>
</dependency>
2.继续在pom.xml中添加如下插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--该选项必须有,否则 devtools不会起作用-->
<fork>true</fork>
<!--支持静态文件热部署-->
<addResources>true</addResources>
</configuration>
</plugin>
3.开启idea的自动build项目设置 file->build,...->Complier->将project automatically勾上

4.做如下设置 Help->Find Action 打开搜索框,并搜索Registry,选择检索列表第一项


5.找到compiler.automake.allow.when.app.running


本文详细介绍如何在Spring Boot项目中配置热部署功能,包括在pom.xml中添加spring-boot-devtools依赖,配置spring-boot-maven-plugin插件,以及在IDEA中启用自动构建和热部署相关设置。
5092

被折叠的 条评论
为什么被折叠?



