zoukankan      html  css  js  c++  java
  • SpringBoot(4) SpringBoot热部署

    热部署,就是在应用正在运行的时候升级软件,却不需要重新启动应用。

    使用springboot结合dev-tool工具,快速加载启动应用

    官方地址:https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#using-boot-devtools
    核心依赖包:
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <optional>true</optional>
    </dependency>
    添加依赖后,在ide里面重启应用,后续修改后马上可以生效。

    pom文件中修改:

     1 <dependencies>
     2     <dependency>
     3         <groupId>org.springframework.boot</groupId>
     4         <artifactId>spring-boot-starter-web</artifactId>
     5     </dependency>    
     6         
     7     <dependency>
     8         <groupId>org.springframework.boot</groupId>
     9         <artifactId>spring-boot-devtools</artifactId>
    10         <optional>true</optional>
    11     </dependency>
    12 </dependencies>
    13 
    14 
    15 <build>
    16   <plugins>
    17     <plugin>
    18       <groupId>org.springframework.boot</groupId>
    19           <artifactId>spring-boot-maven-plugin</artifactId>
    20        </plugin>
    21     </plugins>
    22 </build>

    不被热部署的文件
      1、/META-INF/maven, /META-INF/resources, /resources, /static, /public, or /templates
      2、指定文件不进行热部署 spring.devtools.restart.exclude=static/**,public/**
      3、手工触发重启(改代码不重启,通过一个文本去控制) spring.devtools.restart.trigger-file=trigger.txt

    在application.properties文件中添加

    #指定某些文件不进行监听,即不会进行热加载
    #spring.devtools.restart.exclude=application.properties
    
    #通过触发器,去控制什么时候进行热加载部署新的文件
    spring.devtools.restart.trigger-file=trigger.txt
  • 相关阅读:
    Single Number II
    Pascal's Triangle
    Remove Duplicates from Sorted Array
    Populating Next Right Pointers in Each Node
    Minimum Depth of Binary Tree
    Unique Paths
    Sort Colors
    Swap Nodes in Pairs
    Merge Two Sorted Lists
    Climbing Stairs
  • 原文地址:https://www.cnblogs.com/platycoden/p/9778946.html
Copyright © 2011-2022 走看看