热部署和冷部署有什么区别_weblogic热部署

热部署和冷部署有什么区别_weblogic热部署热部署,就是不需要停掉服务,可以线上改,改完立马生效。

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

在这里插入图片描述

?博客主页:?不会压弯的小飞侠
✨欢迎关注:?点赞?收藏⭐留言✒
✨系列专栏:?SpringBoot专栏(每日更新)
✨如果觉得博主的文章还不错的话,请三连支持一下博主。
?欢迎大佬指正,一起 学习!一起加油!
在这里插入图片描述



?前言

热部署,就是不需要停掉服务,可以线上改,改完立马生效。


?为什么要使用热部署

因为不启用热部署时每次更改java数据都要重启服务器影响开发效率。

?关于热部署:

  • 重启(Restart)∶自定义开发代码,包含类、页面、配置文件等,加载位置restart类加载器
  • 重载(ReLoad) : jar包,加载位置base类加载器

?手动启动热部署

?导入坐标 – 启动开发者工具

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

Jetbrains全家桶1年46,售后保障稳定

?修改数据

方便测试是否启用了热部署:
详细代码:点击直接查看

 @GetMapping("{id}")
    public R getById(@PathVariable Integer id){ 
   
        System.out.println("host deploy...");
        System.out.println("host deploy...");
        System.out.println("host deploy...");
        return new R(true, bookService.getById(id));
    }

?build project

也可以使用快捷键:ctrl + shift9
在这里插入图片描述

?测试

在这里插入图片描述

?自动启动热部署

自动启动热部署步骤:

  1. file
  2. setting
  3. 搜索Compiler,在右侧勾上 “ Build project automatically在这里插入图片描述
  4. 快键键Ctrl+atl+shift+/
  5. 点击Registry 在这里插入图片描述
  6. 勾选第一行这个如下图 在这里插入图片描述

?热部署范围配置

如果想要某些文件或者文件夹不参与热部署的配置需要在application.xml中配置以下信息:

# 设置不参与热部署的文件或文件夹
devtools:
  restart:
    exclude: static/**,public/**,config/application.yml 

?禁用热部署

?方式一

在application.yml中配置:

# 设置不参与热部署的文件或文件夹
devtools:
  restart:
    exclude: static/**,public/**,config/application.yml enabled: false 

这种形式关闭热部署,优先级别太低,可能关闭之后,别人又从别的配置文件或者其他地方给打开了(在优先级别高的地方),从而导致热部署在此启动.

?方式二

?在优先级别高的地方禁用热部署。

  • 属性加载优先顺序:由低到高
    • 1 Default properties (specified by setting springApplication.setDefaultproperties )
    • 2 GPropertySsource annotations on your @Cconfiguration classes. Please note that such property sources are not added to theEnvironment until the application context is being refreshed.This is too late to configure certain properties such as logging.* and spring.main.* which are read before refresh begins.
    • 3 Config data (such as application.properties files)
    • 4 A RandomValuePropertySource that has properties only in random.* .
    • 5 OS environment variables.
    • 6 Java System properties ( system.getProperties() ).
    • 7 JNDl attributes from java:comp/env .
    • 8 ServletContext init parameters.
    • 9 Servletconfig init parameters.
    • 10 Properties from spRING_APpLICATION_soN (inline JSON embedded in an environment variable or system property).
    • 11 Command line arguments.
    • 12 properties attribute on your tests.Available on gSpringRootTest and the test annotations for testing a particular slice ofyour application.
    • 13 @TestPropertySource annotations on your tests.
    • 14 Devtools global settings properties in the SHN’E .config/spring-boot directory when devtools ,s.ati

?application.yml配置文件在优先级为3的地方,可以在优先级为6的地方禁用热部署功能:

package com.jkj;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootHotDeployApplication { 
   
    public static void main(String[] args) { 
   
        System.setProperty("spring.devtools.restart.enabled","false");
        SpringApplication.run(SpringbootHotDeployApplication.class);
    }

}

在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/223041.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • mysql和sqlyog安装教程_mysql 全连接

    mysql和sqlyog安装教程_mysql 全连接最近在学java,然后有涉及数据库,老师说是用MySQL,之前学数据库的时候用的是OracleDatabaseExpress11g,不一样,又得搞一次安装。看了很多教程,也踩了很多坑,记录一下。1.下载MySQLInstaller我下载的是MSIInstaller,感觉这个比较快。也可以下载ZIP,看了教程说要添加my.ini文件,改环境变量什么的。好麻烦。看了用MSIInstaller安装的,不用,所以。。MSIInstaller下载链接选择第二个下载选择Nothanks,j

    2025年6月12日
    5
  • 多层try catch嵌套_方法嵌套一般不超过多少层

    多层try catch嵌套_方法嵌套一般不超过多少层先是aspx页面>其中关键是>GetData是一个自义函数,原型如下:protectedDataTableGetData(objectobj){DataTabledt=newDataTable();//这里做一些事情returndt;}完整的代码如下:aspxnidsbloghttp://www.ljnid.cn>aspx.cs文件usingSys

    2022年10月11日
    3
  • 《Unity开发实战》——2.8节用Shuriken制作粒子效果

    《Unity开发实战》——2.8节用Shuriken制作粒子效果本节书摘来自华章社区 Unity 开发实战 一书中的第 2 章 第 2 8 节用 Shuriken 制作粒子效果 作者 爱尔兰 MattSmith 巴西 ChicoQueiroz 更多章节内容可以访问云栖社区 华章社区 公众号查看 2 8 用 Shuriken 制作粒子效果从 Unity3 5 起 可以用粒子系统制作很多令人惊叹的效果 之前很多需要用脚本实现的效果现

    2025年11月14日
    5
  • rabbitmq实际使用案例_沉默的螺旋案例

    rabbitmq实际使用案例_沉默的螺旋案例一.简单模式(队列–>交换机)yml配置:server:port:8088spring:rabbitmq:host:127.0.0.1port:5672username:guestpassword:guestpublisher-confirm-type:correlated#消息确认方式,通过correlated来确认(将来的消息中才会带correlation_id,只有通过correlation_

    2022年10月3日
    3
  • css清除浮动的五种方法图片_万能清除浮动法

    css清除浮动的五种方法图片_万能清除浮动法css清除浮动有哪五种方法呢?如何使用他们呢

    2025年6月6日
    5
  • html中#include file的使用方法

    html中#include file的使用方法

    2021年11月21日
    65

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号