一、pom.xml导入坐标

在SpringBoot工程的pom.xml配置文件中,添加以下依赖

        
        
            org.springframework.boot
            spring-boot-devtools
            true
        

SpringBoot热部署启动关闭流程是什么

二、手工启动热部署

IDEA中激活热部署

快捷键:Ctrl + F9

图形化界面Build Project

SpringBoot热部署启动关闭流程是什么

三、自动启动热部署

IDEA中自动激活热部署(IDEA失去焦点五秒后自动构建项目,启动热部署)

第一步:

File 》Setting 》Build、Execution、Deployment 》Compiler 》勾选Build project automatically

SpringBoot热部署启动关闭流程是什么

SpringBoot热部署启动关闭流程是什么

第二步:

File 》Setting 》advanced Settings 》勾选Allow auto-make to start even if development application is currently running

SpringBoot热部署启动关闭流程是什么

四、热部署范围配置

关于热部署:

热部署范围配置:

默认不触发重启的目录列表:

springboot配置文件中,手动设置不参与热部署的文件或文件夹:

# 将application.yml设置为不参与热部署,若需要设置多个参数,参数之间用逗号','隔开
spring:
  devtools:
    restart:
      exclude: application.yml

五、关闭热部署

绝对保障,使用不会被配置文件的配置所覆盖的,高优先级配置,来设置热部署关闭:

SpringBoot工程启动类中配置:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootSsmpApplication {
    public static void main(String[] args) {
        //设置热部署关闭
        System.setProperty("spring.devtools.restart.enabled","false");
        SpringApplication.run(SpringbootSsmpApplication.class, args);
    }
}
本文转载于:https://www.yisu.com/zixun/795443.html 如有侵犯,请联系zhengruancom@outlook.com删除。
免责声明:正软商城发布此文仅为传递信息,不代表正软商城认同其观点或证实其描述。