欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

SpringCloudConfig入門-創(chuàng)新互聯(lián)

1.    簡介

創(chuàng)新互聯(lián)專業(yè)IDC數(shù)據(jù)服務器托管提供商,專業(yè)提供成都服務器托管,服務器租用,雅安移動機房,雅安移動機房,成都多線服務器托管等服務器托管服務。

Spring Cloud Config 是用來為分布式系統(tǒng)中為微服務應用提供集中化的外部配置支持,主要分為Spring Cloud Config Server(服務器端)和Spring Cloud Config Client(客戶端)。

2.    Spring Cloud Config Server

Spring Cloud Config Server為服務器端,它是一個單獨的微服務應用,用來連接配置倉庫(本文使用的是git倉庫)并為客戶端獲取配置信息。

1.     首先,創(chuàng)建config server工程

打開http://start.spring.io/

Spring Cloud Config 入門

填寫好Group、Artifact。選擇依賴的包有Config Server。

對應的pom.xml為

<dependencies>

     <dependency>

         <groupId>org.springframework.cloud</groupId>

         <artifactId>spring-cloud-config-server</artifactId>

     </dependency>

     <dependency>

         <groupId>org.springframework.boot</groupId>

         <artifactId>spring-boot-starter-web</artifactId>

     </dependency>

     <dependency>

         <groupId>org.springframework.boot</groupId>

         <artifactId>spring-boot-starter-test</artifactId>

         <scope>test</scope>

     </dependency>

</dependencies>

2.     將下載下來的項目導入Eclipse。

目錄結構如下,我這里面新增了bootstrap.yml

Spring Cloud Config 入門

3.     修改配置

在application.yml中添加

      server:

     port: 8080

在bootstrap.yml中添加

spring:

 cloud:

   config:

     server:

       git:

         uri: https://github.com/DevinXin/config-repo

注意:ConfigServerApplication,Spring Boot 啟動類上需要添加@EnableConfigServer注解

Spring Cloud Config 入門

4.     啟動configServer

通過訪問http://localhost:8080/master/foobar-dev.properties可以讀到git上的配置文件。

Spring Cloud Config 入門

3.    Spring Cloud Config Client

Spring Cloud Config Client為客戶端,客戶端通過配置連接服務器端,從服務器端加載配置信息。

1.     創(chuàng)建config client工程

同config server工程創(chuàng)建一樣,依賴需要web,Config Client

對應的pom.xml為:

<dependencies>

     <dependency>

         <groupId>org.springframework.cloud</groupId>

         <artifactId>spring-cloud-starter-config</artifactId>

     </dependency>

     <dependency>

         <groupId>org.springframework.boot</groupId>

         <artifactId>spring-boot-starter-web</artifactId>

     </dependency>

     <dependency>

         <groupId>org.springframework.boot</groupId>

         <artifactId>spring-boot-starter-test</artifactId>

         <scope>test</scope>

     </dependency>

  </dependencies>

2.     修改配置

application.yml配置為

   server:

   port: 8081

bootstrap.yml配置為

    spring:

     cloud:

       config:

         uri: http://localhost:8080/

         profile: dev

         label: master

     application:

       name: foobar

3.     寫一個Controller

Spring Cloud Config 入門

4.     啟動config Client。

訪問http://localhost:8081/configServer

可以從config Server中獲取到配置文件中的值。

Spring Cloud Config 入門

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

名稱欄目:SpringCloudConfig入門-創(chuàng)新互聯(lián)
URL鏈接:http://www.aaarwkj.com/article20/dpeijo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作定制開發(fā)、做網(wǎng)站網(wǎng)站維護、響應式網(wǎng)站、網(wǎng)站建設

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

h5響應式網(wǎng)站建設
麻豆精东传媒一区二区| 日本成人午夜电影网站| 饥渴少妇高潮露脸嗷嗷叫| 国产激情一区二区三区| 日韩人妻高清精品专区| 三欲一区二区三区中文字幕| 夜福利国产视频大屁股| 中文字幕成人免费看片| 精品毛片在线播放网站不卡| 麻豆国产免费av在线| 人人妻人人澡人人爱| 加勒比av免费在线播放| 中文字幕精品一区二区介绍 | 97免费公开在线观看| 日本人妻系列中文字幕| 极品美女粉嫩啪啪高潮| 国产男女免费视频观看| 午夜久久精品国产亚洲av| 免费毛片一区二区三区四区| 久久亚洲中文字幕精品熟女一区 | 国产在线第一页第二页| 国产日韩精品一区二区在线| 手机在线看国产后入| 尤物天堂av一区二区| 性色视频一区二区三区| 亚洲男人的天堂久久精品| 好看的中文字幕人妻少妇| 婷婷六月亚洲激情综合| 97在线观看免费播放| 亚洲最大成人av在线| 亚洲精品综合在线二区| 国产精品一区二区激情视频| 天堂av在线资源观看| 色婷婷综合五月在线观看| 日本av二区三区在线| 日本亚洲美丽少妇天堂| 成人性生交大片免费看中文 | 日本一区二区 视频| 亚洲一区二区日本久久| 亚洲av色网在线观看| 国产一区精品在线免费看|