Spring Cloud Config-快速开始
来源:互联网 发布:青岛网络电视台回放 编辑:程序博客网 时间:2024/05/18 01:43
Spring Cloud Config为分布式系统中的外部配置提供服务器和客户端支持。使用Config Server,您可以在所有环境中管理应用程序的外部属性。客户端和服务器上的概念映射与Spring Environment
和PropertySource
抽象相同,因此它们与Spring应用程序非常契合,但可以与任何以任何语言运行的应用程序一起使用。随着应用程序通过从开发人员到测试和生产的部署流程,您可以管理这些环境之间的配置,并确定应用程序具有迁移时需要运行的一切。服务器存储后端的默认实现使用git,因此它轻松支持标签版本的配置环境,以及可以访问用于管理内容的各种工具。很容易添加替代实现,并使用Spring配置将其插入。
快速开始
启动服务器:
$ cd spring-cloud-config-server$ ../mvnw spring-boot:run
该服务器是一个Spring Boot应用程序,所以您可以从IDE运行它,而不是喜欢(主类是ConfigServerApplication
)。然后尝试一个客户端:
$ curl localhost:8888/foo/development{"name":"development","label":"master","propertySources":[ {"name":"https://github.com/scratches/config-repo/foo-development.properties","source":{"bar":"spam"}}, {"name":"https://github.com/scratches/config-repo/foo.properties","source":{"foo":"bar"}}]}
定位资源的默认策略是克隆一个git仓库(在spring.cloud.config.server.git.uri
),并使用它来初始化一个迷你SpringApplication
。小应用程序的Environment
用于枚举属性源并通过JSON端点发布。
HTTP服务具有以下格式的资源:
/{application}/{profile}[/{label}]/{application}-{profile}.yml/{label}/{application}-{profile}.yml/{application}-{profile}.properties/{label}/{application}-{profile}.properties
其中“应用程序”作为SpringApplication
中的spring.config.name
注入(即常规的Spring Boot应用程序中通常是“应用程序”),“配置文件”是活动配置文件(或逗号分隔列表的属性),“label”是可选的git标签(默认为“master”)。
Spring Cloud Config服务器从git存储库(必须提供)为远程客户端提供配置:
spring: cloud: config: server: git: uri: https://github.com/spring-cloud-samples/config-repo
从现在开始,我这边会将近期研发的springcloud微服务云架构的搭建过程和精髓记录下来,帮助更多有兴趣研发spring cloud框架的朋友,希望可以帮助更多的好学者。大家来一起探讨spring cloud架构的搭建过程及如何运用于企业项目。源码来源
- Spring Cloud Config-快速开始
- Spring Cloud Config-快速开始
- 开始Spring Cloud Config
- 开始Spring Cloud Config
- Spring Cloud Config 快速入门
- spring cloud:spring cloud config
- spring基础:快速入门spring cloud(6):统一配置管理之spring cloud config
- Spring Cloud Config
- 关于spring cloud config
- spring cloud config使用
- Spring Cloud Config
- Spring Cloud Config 实践
- Spring Cloud Config
- Spring Cloud Config
- spring cloud config 配置
- 聊聊 Spring Cloud Config
- Spring Cloud Config Server
- 详解Spring Cloud Config
- ORA-00904: "T1_DESC": 标识符无效
- 搭建nginx-logstash-kafka-elasticsearch服务
- eclipse 环境搭建-scala
- HTML-a
- 微信小程序支付源码 Demo 后台服务端代码
- Spring Cloud Config-快速开始
- 定位关键代码(施工中)
- Web 性能优化
- Windows7下安装与破解IntelliJ IDEA
- 大数据分析报告显示,多少年薪才能让80后摆脱中年危机?
- Spring Cloud Config—客户端使用
- npm 安装包报错 rollbackFailedOptional
- Python安全小工具之日志分析识别AWVS扫描
- 构建高性能MySQL体系