学无先后,达者为师

网站首页 编程语言 正文

springboot的热部署配置

作者:CAUC_lin 更新时间: 2022-08-15 编程语言

前言

  • 在开发项目时,当修改了代码,需要重新启动服务,如果项目比较大,需要较长时间启动
  • 热部署插件:spring-boot-devtools可以解决这个问题

环境

当前使用的springboot是2.7.2版本

步骤

  1. 加入依赖jar包

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
            </dependency>
    
  2. 在setting设置自动编译

    在这里插入图片描述

  3. registry中设置允许程序运行时编译

    在项目任意页面中使用组合快捷键“Ctrl+Shift+Alt+/”打开Maintenance选项框,选中并打开Registry页面

    在这里插入图片描述

  4. 启动程序测试

    在这里插入图片描述

    不重启程序,将返回值修改为“热部署~”,测试成功

在这里插入图片描述

原文链接:https://blog.csdn.net/CAUC_lin/article/details/126333794

栏目分类
最近更新