参考资料:

  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/

文件系统后端:

  Config Server中有一个不适用Git的"native"配置文件,只是从本地类路径或文件系统中加载配置(你可以使用"spring.cloud.config.server.native.searchLocations"指向任何的静态URL).  

  想要使用native profile,只需要使用“spring.profiles.active=native”启动Config Server即可。

  NOTE:

    记得文件资源使用 file: 前缀(通常的类路径默认是没有前缀的)。

    就像任何的Spring Boot配置一样,可以嵌入${}风格的环境占位符,但是请记住,Windows中绝对路径需要额外的添加"/",例如:file:///${user.home}/config-repo。

  WARNING:

    searchLocations 的默认值与本地的Spring Boot应用程序(所以[classpath:/, classpath:/config, file:./, file:./config])相同。这不会将 application.properties从服务器暴露给所有客户端,因为在发送给客户端前,服务器中存在的任何的属性源将被删除。

  TIP:

    文件系统后端非常适合快速入门和测试。要在成产中使用它,需要保证文件系统是可靠的,并且在Config Server的所有实例中共享。

  搜索位置可以包含{application}{profile}{label}占位符。通过这种方式可以分割路径中的目录,并选择一个对你有意义的策略(例如,每个application的子目录,每个profile的子目录)。

  如果不在搜索位置是用占位符,该存储库也会将HTTP资源的{label}追加到搜索路径的后缀上,因此属性文件将从每个搜索位置和与标签名相同的子目录中加载(被标记的属性在Spring环境中有限)。因此没有占位符的默认行为与末尾添加了/{label}/的搜索位置相同。例如:file:/tmp/configfile:/tmp/config,file:/tmp/config/{label}相同。这个行为可以通过设置spring.cloud.config.server.native.addLabelLocations=false来禁用。

spring-cloud-config-server——Environment Repository(File System Backend)的更多相关文章

  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官方文档中文版-Spring Cloud Config(上)

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

  5. Spring Cloud Config中文文档

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

  6. Spring Cloud config之一:分布式配置中心入门介绍

    Spring Cloud Config为服务端和客户端提供了分布式系统的外部化配置支持.配置服务器为各应用的所有环境提供了一个中心化的外部配置.它实现了对服务端和客户端对Spring Environm ...

  7. spring cloud连载第二篇之Spring Cloud Config

    Spring Cloud Config Spring Cloud Config为分布式服务提供了服务侧和客户侧的外部配置支持.通过Spring Cloud Config你可以有一个统一的地方来管理所有 ...

  8. spring cloud config 详解

    Spring Cloud 为开发人员提供了一系列的工具来快速构建分布式系统的通用模型 .例如:配置管理.服务发现.断路由.智能路由.微代理.控制总线.一次性Token.全局锁.决策竞选.分布式sess ...

  9. Spring Cloud官方文档中文版-Spring Cloud Config(上)-服务端(配置中心)

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

随机推荐

  1. GitLab上传项目到新的分支

    多人协同开发,GitLab上的group仓库里的master分支作为开发分支(最终从dev提交的代码),dev分支作为每个人的代码测试后合并的分支,每个人需要定期merge request自己的分支到 ...

  2. ASP.NET Core 实现跨站登录重定向的新姿势

    作为 .NET 程序员,痛苦之一是自从 ASP.NET 诞生之日起直到最新的 ASP.NET Core 都无法直接实现跨站登录重定向(比如访问 https://q.cnblogs.com ,跳转到 h ...

  3. spring 开始构造

    1,选择“org.apache.maven.archetypes:maven-archetype-webapp”骨架(模板),创建一个Web项目: 在main 目录下创建文件夹  java,  res ...

  4. Codeforces 570 - A/B/C/D/E - (Done)

    链接:https://codeforces.com/contest/570 A - Elections - [水] AC代码: #include<bits/stdc++.h> using ...

  5. Golang go get第三方库的坑

    在树莓派上go get fail的问题记录及解决方案 go get github.com/terrancewong/serial # 错误为GOPATH路径的问题 cannot find packag ...

  6. LeetCode 520 Detect Capital 解题报告

    题目要求 Given a word, you need to judge whether the usage of capitals in it is right or not. We define ...

  7. Restsharp常见格式的发送分析

    1.传递匿名对象JSON格式 public string Pay(string apisecret, string apikey, string token) { try { string url = ...

  8. MAC OSX Xcode硬盘清理

    1.移除对旧设备的支持影响:可重新生成:再连接旧设备调试时,会重新自动生成.我移除了4.3.2, 5.0, 5.1等版本的设备支持.路径:~/Library/Developer/Xcode/iOS D ...

  9. python摸爬滚打之day21---- 模块

    1.MD5加密模块 MD5是一种不可逆的加密算法, 是安全而且可靠的.  在某些网站上能够搜到MD5解密工具, 其实并没有解密工具, 而是"撞库"的方式. 网站将一些MD5数据保存 ...

  10. git本地仓库 push到远程仓库出现错误

    ! [rejected] master -> master (fetch first) error: failed to push some refs to hint: Updates were ...