當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
Spring Cloud Config git版
生活随笔
收集整理的這篇文章主要介紹了
Spring Cloud Config git版
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
POM文件
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId> </dependency>?
git版配置文件
spring:application:name: config-servercloud:config:server:git:uri: https://gitee.com/qubaba/spring-cloud-config # git路徑 username: # 私有倉庫的話需要輸入git的賬號密碼password: search-paths: /spring-cloud-config # 查找該路徑下的所有文件default-label: spring-cloud-config # 默認的分支?
啟動類
@SpringBootApplication @EnableConfigServer public class ConfigServerApplication { ?public static void main(String[] args) {SpringApplication.run(ConfigServerApplication.class, args);} ? } ??
?
關鍵注解為:@EnableConfigServer表示啟動類為配置服務類。
?
訪問到配置服務器的配置文件后會在本地生成一份配置文件的副本。
config Client
POM文件
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-config</artifactId> </dependency>?
配置文件
spring cloud config 的配置文件需要提前加載所以需要在resources目錄下新建文件bootstrap.yml文件
spring:profiles:active: dev # 默認加載配置文件application:name: configcloud:config:uri: http://localhost:9000 # 配置服務器地址 name: ${spring.application.name} # application Nameprofile: ${spring.profiles.active} # 那個類型的配置為文件?
轉載于:https://www.cnblogs.com/qubaba/p/10843201.html
總結
以上是生活随笔為你收集整理的Spring Cloud Config git版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: BCI2000对win10的支持
- 下一篇: gradle idea java ssm