日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

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

發(fā)布時間:2023/12/19 综合教程 41 生活家
生活随笔 收集整理的這篇文章主要介紹了 热部署和冷部署有什么区别_weblogic热部署 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?博客主頁:?不會壓彎的小飛俠
✨歡迎關(guān)注:?點贊?收藏⭐留言✒
✨系列專欄:?SpringBoot專欄(每日更新)
✨如果覺得博主的文章還不錯的話,請三連支持一下博主。
?歡迎大佬指正,一起 學習!一起加油!



?前言

熱部署,就是不需要停掉服務,可以線上改,改完立馬生效。


?為什么要使用熱部署

因為不啟用熱部署時每次更改java數(shù)據(jù)都要重啟服務器影響開發(fā)效率。

?關(guān)于熱部署:

  • 重啟(Restart)∶自定義開發(fā)代碼,包含類、頁面、配置文件等,加載位置restart類加載器
  • 重載(ReLoad) : jar包,加載位置base類加載器

?手動啟動熱部署

?導入坐標 – 啟動開發(fā)者工具

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

Jetbrains全家桶1年46,售后保障穩(wěn)定

?修改數(shù)據(jù)

方便測試是否啟用了熱部署:
詳細代碼:點擊直接查看

 @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,在右側(cè)勾上 “ 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 

這種形式關(guān)閉熱部署,優(yōu)先級別太低,可能關(guān)閉之后,別人又從別的配置文件或者其他地方給打開了(在優(yōu)先級別高的地方),從而導致熱部署在此啟動.

?方式二

?在優(yōu)先級別高的地方禁用熱部署。

  • 屬性加載優(yōu)先順序:由低到高
    • 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配置文件在優(yōu)先級為3的地方,可以在優(yōu)先級為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);
    }

}

總結(jié)

以上是生活随笔為你收集整理的热部署和冷部署有什么区别_weblogic热部署的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。