docker默認端口,第十二章:Spring Cloud Config Server 的配置

 2023-10-08 阅读 22 评论 0

摘要:###1.為什么要使用config 集中管理不通環境不通配置運行期間動態調整配置自動刷新 ###2.用法入門導入pom <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId></dependency>

###1.為什么要使用config

  1. 集中管理
  2. 不通環境不通配置
  3. 運行期間動態調整配置
  4. 自動刷新 ###2.用法入門
  5. 導入pom
		<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId></dependency>
復制代碼
  1. 啟動類添加注解 @EnableConfigServer
  2. 修改application.yml
spring:cloud:config:server:git:uri: https://github.com/jiaofanting/spring-cloud-config-repo/
server:port: 8080復制代碼

docker默認端口?這個uri是我git目錄放的一個application.yml 路徑,打開是404,因為它不是一個有效的鏈接,它只是說明了 application.yml文件放在哪里。 4. 看官方文檔說明

The HTTP service has resources in the form:/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.propertieswhere the "application" is injected as the spring.config.name in the SpringApplication (i.e. what is normally "application" in a regular Spring Boot app), "profile" is an active profile (or comma-separated list of properties), and "label" is an optional git label (**defaults to "master".**)
復制代碼

截圖更清晰

注意中間有個- ,對照文檔看效果

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/130669.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息