参考资料:

  https://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.4.0.RELEASE/single/spring-cloud-config.html

  http://cloud.spring.io/spring-cloud-static/Camden.SR7/#_environment_repository

Environment Repository——环境库

  你要在哪里存储Config Server的配置数据呢?管理这种行为的策略是为Enviroment对象提供服务的EnvironmentRepository。这个Enviroment是Spring Environment域的一个浅层副本(包括propertySources作为主要功能)。Environment资源由三个变量参数化:

  1. {application} maps to "spring.application.name" on the client side;——{application}映射到客户端的"spring.application.name";
  2. {profile} maps to "spring.profiles.active" on the client (comma separated list);——{profile}映射到客户端的 "spring.profiles.active"(逗号分割列表);
  3. {label} which is a server side feature labelling a "versioned" set of config files.——{label}是服务端功能,标记"版本化"的配置文件集。

  版本库实现通常像Spring Boot应用程序一样从“spring.config.name”加载配置文件,等同于{application}参数,而“spring.profiles.active”等同于{profiles}参数。配置文件的优先级规则也与常规的Boot应用程序中的规则相同:活动配置文件优先于默认配置,并且如果有多个配置文件,则最后一个配置文件将胜出(如向Map添加条目)。

  例如,客户端应用程序具有此引导配置:

  bootstrap.yml

spring:
application:
name: foo
profiles:
active: dev,mysql

  (通常使用Spring Boot应用程序,这些属性也可以设置为环境变量或命令行参数)

  如果存储库是基于文件的,则服务器将从application.yml(所有客户端之间共享)和foo.yml(以yoo.yml优先)创建一个Environment。如果YAML文件中有指向Spring配置文件的文档,那么这些文件将以更高的优先级(按列出的配置文件的顺序)应用,如果有特定于配置文件的YAML(或属性)文件,则这些文件的优先级高于默认值。较高的优先级转换为Environment之前列出的PropertySource.(这些规则于独立的Spring Boot应用程序相同)。

spring-cloud-config-server——Environment Repository的更多相关文章

  1. Spring Cloud Config Server 节点迁移引起的问题,请格外注意这一点!

    前言: 虽然强烈推荐选择使用国内开源的配置中心,如携程开源的 Apollo 配置中心.阿里开源的 Nacos 注册&配置中心. 但实际架构选型时,根据实际项目规模.业务复杂性等因素,有的项目还 ...

  2. 为Spring Cloud Config Server配置远程git仓库

    简介 虽然在开发过程,在本地创建git仓库操作起来非常方便,但是在实际项目应用中,多个项目组需要通过一个中心服务器来共享配置,所以Spring Cloud配置中心支持远程git仓库,以使分散的项目组更 ...

  3. ubuntu14.04 spring cloud config server + gradle搭建

    Server端:在eclipse上,创建Java Project项目.自带的src包删掉手动建文件夹.基础的目录文件都创建上 |--ZSpringCloud|--build.gradle|----sr ...

  4. Spring Cloud config之三:config-server因为server端和client端的健康检查导致服务超时阻塞问题

    springcloud线上一个问题,当config-server连不上git时,微服务集群慢慢的都挂掉. 在入口层增加了日志跟踪问题: org.springframework.cloud.config ...

  5. 网络原因导致的 spring cloud config 读取git上的配置文件时报错:Cannot clone or checkout repository

    今天在公司使用spring cloud config搭建配置中心的时候,出现了读取不到git库的问题:Cannot clone or checkout repository.在网上百度,前面几个答案都 ...

  6. Spring Cloud Config

    Spring Cloud Config provides server and client-side support for externalized configuration in a dist ...

  7. Spring Cloud官方文档中文版-Spring Cloud Config(上)

    官方文档地址为:http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#spring-cloud-feign 文中例子我做了一些测试在:http ...

  8. spring cloud config服务器

    Spring Cloud Config提供了一种在分布式系统中外部化配置服务器和客户端的支持.配置服务器有一个中心位置,管理所有环境下的应用的外部属性.客户端和服务器映射到相同Spring Event ...

  9. Spring Cloud Config中文文档

    https://springcloud.cc/spring-cloud-config.html 目录 快速开始 客户端使用 Spring Cloud Config服务器 环境库 健康指标 安全 加密和 ...

  10. Spring Cloud config之二:功能介绍

    SVN配置仓库 示例见:http://lvdccyb.iteye.com/blog/2282407 本地仓库 本地文件系统 使用本地加载配置文件.需要配置:spring.cloud.config.se ...

随机推荐

  1. MUI - 复选框、单选框、使用js获取选择值

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...

  2. SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)【申明:来源于网络】

    SSM框架--详细整合教程(Spring+SpringMVC+MyBatis)[申明:来源于网络] 地址:http://blog.csdn.net/u014662268/article/details ...

  3. python下载网页视频

    因网站不同需要修改. 下载 mp4 连接 from bs4 import BeautifulSoup import requests import urllib import re import js ...

  4. 常用oracle hints

    在SQL语句优化过程中,经常会用到hint, 以下是在SQL优化过程中常见Oracle中"HINT"的30个用法 1. /*+ALL_ROWS*/ 表明对语句块选择基于开销的优化方 ...

  5. JS — 获取4个不重复的随机验证码

    var strCode='zxcvbnmasdfghjklopiuytrewqAWEDRFTGYHUJIK'; var str=''; for(var i=0;i<4;i++){ var ran ...

  6. python 发送带附件的邮件

    特别注意的地方:filespart.add_header("Content-Disposition","attachment",filename=file_na ...

  7. Object.keys()的理解

    Object.keys(obj) 方法会返回一个由一个给定对象的自身可枚举属性组成的数组,数组中属性名的排列顺序和使用 for...in 循环遍历该对象时返回的顺序一致. 例子如下: ①.简单的数组( ...

  8. SQLAlchemy(包含有Flask-Migrate知识点)

    what's the SQLAlchemy SQLAlchemy是一个基于Python实现的ORM框架.该框架建立在 DB API之上,使用关系对象映射进行数据库操作,简言之便是:将类和对象转换成SQ ...

  9. java框架之SpringBoot(1)-入门

    简介 Spring Boot 用来简化 Spring 应用开发,约定大于配置,去繁从简,just run 就能创建一个独立的.产品级别的应用. 背景: J2EE 笨重的开发.繁多的配置.低下的开发效率 ...

  10. 通过android studio的gradle强制cmake输出命令详情

    https://stackoverflow.com/questions/43439549/force-cmake-in-verbose-mode-via-gradle-and-the-android- ...