SpringBoot热部署

Posted 陈彦斌

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot热部署相关的知识,希望对你有一定的参考价值。

什么是热部署

  • 应用正在运行的时候升级功能,不需要重新启动应用
  • 对于Java应用程序来说,热部署就是在运行时更新Java类文件

好处:不需要重新手工启动应用,提高本地开发效率

常见热部署

  • jrebel
  • Spring Loaded
  • spring-boot-devtools

步骤

pom文件添加依赖包

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork> <!-- 必须加入配置 -->
                </configuration>
            </plugin>
        </plugins>
    </build>

idea配置

使用快捷键打开,选择Registry

注意默认快捷键
    window快捷键:shift+ctrl+Alt+/
    mac快捷键:shift+Command+option+/

 

选择compiler.automake.allow.when.app.running,重启idea就行!!

 

以上是关于SpringBoot热部署的主要内容,如果未能解决你的问题,请参考以下文章

利用 jrebel 热部署远程调试远程热部署 springboot项目 服务器上的代码

在SpringBoot中使用热部署(DevTools)

idea内springboot项目设置热部署

SpringBoot入门篇--热部署

SpringBoot------热部署(Springloaded)

IDEA-SpringBoot项目设置热部署