0
点赞
收藏
分享

微信扫一扫

SpringBoot项目开启热部署功能

静守幸福 2022-01-09 阅读 65

springboot提供了热部署功能,在我们修改了代码进行保存后,程序会自动帮我们将修改的代码进行编译运行。

1.热部署需要导入的pom文件

<!--devtools依赖jar包-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>
<!--插件配置-->
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>true</fork>
        <addResources>true</addResources>
    </configuration>
</plugin>

2.进入idea的设置File | Settings | Build, Execution, Deployment | Compiler中启用自动编译功能选项.
在这里插入图片描述
3.使用快捷键ctrl + shift + Alt + /打开idea的注册表,直接键盘输入查找到如下的两个功能选项,勾选启用对应的功能,点击close即可。
在这里插入图片描述
完成上述设置与操作就可以实现项目的热部署功能,如果依旧没有生效,尝试重启idea即可。

举报

相关推荐

0 条评论