SpringBoot 热部署。
文章目录
- SpringBoot 热部署。
 
- pom.xml。
 
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
 
使用 optional=true 表示依赖不会传递,即该项目依赖 devtools,其他项目如果引入此项目生成的 JAR 包,则不会包含 devtools。
- application.yaml。
 
spring:
  devtools:
    restart:
      # 热部署生效。
      enabled: true
      # 设置重启目录。
      additional-paths: src/main/java
      # 设置 classpath 目录下 WEB-INF 文件夹内容修改不重启。
      exclude: static/**
 
- Intellij IDEA 配置。
 

按 Ctrl + Shift + Alt + / 快捷键调出 Maintenance 页面,单击 Registry,勾选 compiler.automake.allow.when.app.running 复选框。


















