Spring Cloud:Config配置

简介:

Spring Cloud Config provides server and client-side support for externalized configuration in a distributed system. With the Config Server you have a central place to manage external properties for applications across all environments. The concepts on both client and server map identically to the Spring Environment and PropertySource abstractions, so they fit very well with Spring applications, but can be used with any application running in any language. As an application moves through the deployment pipeline from dev to test and into production you can manage the configuration between those environments and be certain that applications have everything they need to run when they migrate. The default implementation of the server storage backend uses git so it easily supports labelled versions of configuration environments, as well as being accessible to a wide range of tooling for managing the content. It is easy to add alternative implementations and plug them in with Spring configuration.

Spring Cloud Config为分布式系统中的外部化配置提供服务器和客户端支持。 使用Config Server,您可以集中管理所有环境中应用程序的外部属性。 客户端和服务器上的概念与Spring Environment和PropertySource抽象完全相同,因此它们非常适合Spring应用程序,但可以与以任何语言运行的任何应用程序一起使用。 当应用程序从开发人员迁移到测试人员并进入生产过程时,您可以管理这些环境之间的配置,并确保应用程序具备迁移时所需的一切。 服务器存储后端的默认实现使用git,因此它轻松支持配置环境的标记版本,并且可用于管理内容的各种工具。 添加替代实现并将其插入Spring配置很容易。

Features

Spring Cloud Config Server features:

  • HTTP, resource-based API for external configuration (name-value pairs, or equivalent YAML content)
  • Encrypt and decrypt property values (symmetric or asymmetric)
  • Embeddable easily in a Spring Boot application using @EnableConfigServer

Config Client features (for Spring applications):

  • Bind to the Config Server and initialize Spring Environment with remote property sources
  • Encrypt and decrypt property values (symmetric or asymmetric)

特征


Spring Cloud Config Server功能:

  • HTTP,用于外部配置的基于资源的API(名称-值对,或等效的YAML内容)

  • 加密和解密属性值(对称或非对称)

  • 使用@EnableConfigServer可轻松嵌入到Spring Boot应用程序中

Config Client功能(用于Spring应用程序):

  • 绑定到Config Server并使用远程属性源初始化Spring Environment

  • 加密和解密属性值(对称或非对称)


环境准备:在自己GitHub上新建一个Repository作为config center;注册中心使用的consul
命名规范:lable 分支名,application 应用名(自定),profile 如:dev、test、prod
  • /{lable}/{application}-{profile}.yml
  • /{application}-{profile}.yml
  • /{application}/{profile}/{lable}
如:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lMnYeUIw-1593653639361)(G:\微云同步\同步文件\Microsoft同步\文档\images\image-20200702090219299.png)]

Config Center Server

POM
<dependency>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DeathAndLife

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值