• SpringBoot实现热部署(修改class不需要重启)


    https://www.cnblogs.com/MrXiaoAndDong/p/SpringBootHotDeploy.html

    热部署:
    devtools可以实现页面热部署(即页面修改后会立即生效,
    这个可以直接在application.properties文件中配置spring.thymeleaf.cache=false来实现)
    实现类文件热部署(类文件修改后不会立即生效),实现对属性文件的热部署。
    注意:因为采用的虚拟机机制,该项重启是很快的
    (1)base classloader (Base类加载器):加载不改变的Class,例如:第三方提供的jar包。
    (2)restart classloader (Restart类加载器):加载正在开发的Class。
    为什么启动很快,因为重启的时候只是加载了在开发的Class,没用重新加载第三方的jar包。

    1.使用方法:只需要在pom中加入如下依赖即可:

    复制代码
    <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-devtools</artifactId>
          <version>1.5.6.RELEASE</version>
          <!--optional=true,依赖不会传递,该项目依赖devtools;之后
             依赖boot项目的项目如果想要使用devtools,需要重新引入-->
          <optional>true</optional>
    </dependency>
    复制代码

     2.修改application.properties

    复制代码
    #关闭缓存,即时刷新
    #spring.freemaker.cashe=false
    spring.thymeleaf.cache=true
    
    #热部署生效
    spring.devtools.restart.enable=true
    #设置重启的目录,添加那个目录的文件需要restart
    spring.devtools.restart.additional-paths=src/main/java
    #为mybatis设置,生产环境可删除
    #restart.include.mapper=/mapper-[\w-\.]+jar
    #restart.include.pagehelper=/pagehelper-[\w-\.]+jar
    #排除那个目录的文件不需要restart
    #spring.devtools.restart.exclude=static/**,public/**
    #classpath目录下的WEB-INF文件夹内容修改不重启
    #spring.devtools.restart.exclude=WEB-INF/**
    复制代码
  • 相关阅读:
    空心杯 电机
    scikit learn 安装
    python fromkeys() 创建字典
    python 清空列表
    mac最常用快捷键
    php while循环
    php 获取某个日期n天之后的日期
    php 添加时间戳
    php 格式化时间
    php 数值数组遍历
  • 原文地址:https://www.cnblogs.com/zhoading/p/14422246.html
Copyright © 2020-2023  润新知