亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

springboot配置文件抽離 git管理統(tǒng) 配置中心詳解

 更新時間:2019年09月02日 15:47:47   作者:yu_fly  
在本篇文章里小編給大家整理的是關于springboot配置文件抽離 git管理統(tǒng) 配置中心的相關知識點內容,有需要的朋友們可以學習下。

springboot配置文件抽離,便于服務器讀取對應配置文件,避免項目頻繁更改配置文件,影響項目的調試與發(fā)布

1.創(chuàng)建統(tǒng)一配置中心項目conifg

1)pom配置依賴

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.0.6.RELEASE</version>
  <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  <java.version>1.8</java.version>
  <spring-cloud.version>Finchley.SR2</spring-cloud.version>
</properties>

<dependencies>
  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
  </dependency>
  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  </dependency>

  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bus-amqp</artifactId>
  </dependency>

  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-monitor</artifactId>
  </dependency>
</dependencies>

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-dependencies</artifactId>
      <version>${spring-cloud.version}</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

2)yml文件配置

spring:
 application:
  name: config
 cloud:
  config:
   server:
    git:
     uri: https://gitee.com/XXXX/XXXXXX.git
     username: XXXXXXX
     password: XXXXXXXXX
eureka:
 client:
  service-url:
   defaultZone: http://localhost:8000/eureka/
management:
 endpoints:
  web:
   expose: "*"

2.創(chuàng)建git私有項目config-repo 用于存放配置文件

3.配置項目 可以看到對應的配置文件內容

http://localhost:8002/XXXXX/user-dev.yml

4.配置客戶端讀取配置文件

1)客戶端配置pom

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-config-client</artifactId>
</dependency>

2)客戶端yml文件配置

spring:
 application:
  name: XXXXXX
 cloud:
  config:
   discovery:
    enabled: true
    service-id: CONFIG
   profile: dev



eureka:
 client:
  service-url:
   defaultZone: http://localhost:8000/eureka/
 instance:
  prefer-ip-address: true
  lease-renewal-interval-in-seconds: 1 # 單機時關閉eureka 保護模式
  lease-expiration-duration-in-seconds: 2

以上就是本次介紹的關于springboot配置文件抽離 git管理統(tǒng) 配置中心全部知識點內容,感謝大家對腳本之家的支持。

相關文章

  • 使用Python進行AES加密和解密的示例代碼

    使用Python進行AES加密和解密的示例代碼

    這篇文章主要介紹了使用Python進行AES加密和解密的示例代碼,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-02-02
  • PHP基于phpqrcode類庫生成二維碼過程解析

    PHP基于phpqrcode類庫生成二維碼過程解析

    這篇文章主要介紹了PHP基于phpqrcode類庫生成二維碼過程解析,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2020-05-05
  • 解讀python如何實現決策樹算法

    解讀python如何實現決策樹算法

    在本篇文章里我們給讀者們分享了關于python如何實現決策樹算法的相關知識點內容,需要的朋友們參考下。
    2018-10-10
  • Python3遠程監(jiān)控程序的實現方法

    Python3遠程監(jiān)控程序的實現方法

    今天小編就為大家分享一篇Python3遠程監(jiān)控程序的實現方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-07-07
  • Python繪畫好看的星空圖

    Python繪畫好看的星空圖

    這篇文章主要介紹了Python繪畫好看的星空圖,文章內容介紹詳細,具有一定的參考價值,需要的小伙伴可以參考一下
    2022-03-03
  • Python使用Pillow進行圖像處理

    Python使用Pillow進行圖像處理

    這篇文章介紹了Python使用Pillow進行圖像處理的方法,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-06-06
  • numpy的文件存儲.npy .npz 文件詳解

    numpy的文件存儲.npy .npz 文件詳解

    今天小編就為大家分享一篇numpy的文件存儲.npy .npz 文件詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-07-07
  • Python根據輸入參數計算結果的實例方法

    Python根據輸入參數計算結果的實例方法

    在本篇文章里小編個大家整理了一篇關于Python根據輸入參數計算結果的實例方法,有興趣的朋友們可以跟著學習參考下。
    2021-08-08
  • Python3中的循環(huán)語句示例詳解

    Python3中的循環(huán)語句示例詳解

    這篇文章主要介紹了Python3?循環(huán)語句,本文將詳細介紹Python3中的循環(huán)語句,給出各種循環(huán)的使用示例,以及運行結果的解釋,需要的朋友可以參考下
    2023-04-04
  • Python hashlib模塊實例使用詳解

    Python hashlib模塊實例使用詳解

    這篇文章主要介紹了Python hashlib模塊實例使用詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2019-12-12

最新評論