pring Cloud 版本:2.1.0.RELEASE

一、server端

1.maven依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>

2.配置文件

注:application.yml

eureka:
client:
serviceUrl:
defaultZone: http://localhost:8080/eureka/
server:
port: 8888
spring:
application:
name: module-config-server     #注册的服务名
cloud:
config:
server:
git:
uri: https://github.com/XXX #git地址
search-paths: /config     #git下的路径
username:   #git用户名
password:   #git密码

3.源码解析

 

二、client端

1.maven依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>

2.配置文件

注:bootstrap.yml,此时必须使用bootstrap.yml,优先级大于application.yml,可以在启动的时候去server端fetch配置文件的信息

server:
port: 8081
eureka:
instance:
hostname: localhost
appname: order
client:
service-url:
defaultZone: http://localhost:8080/eureka/
spring:
application:
name: order
cloud:
config:
discovery:
enabled: true
service-id: module-config-server
# enabled: true 可以省略
label: master
profile: dev
# uri: http://localhost:8888/ 默认就是这个地址,可以省略,有service-id时,优先使用service-id
 

1.分布式配置中心 spring-cloud-config的更多相关文章

  1. 第六篇: 分布式配置中心(Spring Cloud Config)

    一.简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管理,实时更新,所以需要分布式配置中心组件. 在Spring Cloud中,有分布式配置中心组件spring cloud confi ...

  2. 一起来学Spring Cloud | 第七章:分布式配置中心(Spring Cloud Config)

    上一章节,我们讲解了服务网关zuul,本章节我们从git和本地两种存储配置信息的方式来讲解springcloud的分布式配置中心-Spring Cloud Config. 一.Spring Cloud ...

  3. Spring Cloud Config(一):聊聊分布式配置中心 Spring Cloud Config

    目录 Spring Cloud Config(一):聊聊分布式配置中心 Spring Cloud Config Spring Cloud Config(二):基于Git搭建配置中心 Spring Cl ...

  4. SpringCloud(6)分布式配置中心Spring Cloud Config

    1.Spring Cloud Config 简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管理,实时更新,所以需要分布式配置中心组件.在Spring Cloud中,有分布式配置中心组 ...

  5. SpringCloud教程 | 第六篇: 分布式配置中心(Spring Cloud Config)

    一.简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管理,实时更新,所以需要分布式配置中心组件.在Spring Cloud中,有分布式配置中心组件spring cloud config ...

  6. 史上最简单的SpringCloud教程 | 第六篇: 分布式配置中心(Spring Cloud Config)

    一.简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管理,实时更新,所以需要分布式配置中心组件. 在Spring Cloud中,有分布式配置中心组件spring cloud confi ...

  7. spring cloud 入门系列七:基于Git存储的分布式配置中心--Spring Cloud Config

    我们前面接触到的spring cloud组件都是基于Netflix的组件进行实现的,这次我们来看下spring cloud 团队自己创建的一个全新项目:Spring Cloud Config.它用来为 ...

  8. SpringCloud教程 | 第六篇: 分布式配置中心(Spring Cloud Config)(Finchley版本)

    在上一篇文章讲述zuul的时候,已经提到过,使用配置服务来保存各个服务的配置文件.它就是Spring Cloud Config. 一.简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管 ...

  9. 【SpringCloud】第七篇: 高可用的分布式配置中心(Spring Cloud Config)

    前言: 必需学会SpringBoot基础知识 简介: spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选. ...

  10. 【SpringCloud】第六篇: 分布式配置中心(Spring Cloud Config)

    前言: 必需学会SpringBoot基础知识 简介: spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选. ...

随机推荐

  1. 捕捉Promise reject 错误

    var sleep = function (time) { return new Promise(function (resolve, reject) { setTimeout(function () ...

  2. redis—django-redis

    自定义连接池 这种方式跟普通py文件操作redis一样,代码如下: views.py import redis from django.shortcuts import render,HttpResp ...

  3. myBatis的坑 01 %的坑 框架内置的小BUG

    <select id="queryUserLikeUserName" resultType="cn.itcast.pojo.User"> selec ...

  4. 基本算法 st

    今天困得不行,就看了个小算法st,其实和线段树的作用一样, 不过这个算法没有用到数据结构,使用二进制优化的 是O(log(n)n)的时间预处理,然后以O(1)的时间返回(l,r)上的最大或最小 #in ...

  5. Elasticsearch下载安装

    本文链接:https://blog.csdn.net/yjclsx/article/details/81302041注:Elasticsearch 需要 Java 8 环境,在安装Elasticsea ...

  6. 【高维前缀和】8.15B. 组合数

    题目分析 没有接触过高维前缀和的话会有一点抽象

  7. MySQL剖析单条查询

    使用SHOW PROFILE SHOW PROFILE命令默认是禁用的,可以通过以下命令修改 SET profiling=1; 当一条查询提交给服务器时,,此工具会记录剖析信息到一张临时表,并且给查询 ...

  8. BZOJ 2527 [Poi2011]Meteors (整体二分+树状数组)

    整体二分板题,没啥好讲的-注意是个环-还有所有贡献会爆longlong,那么只要在加之前判断一下有没有达到需要的值就行了- CODE #include <set> #include < ...

  9. 【细谈Java并发】谈谈LinkedBlockingQueue(转)

    最近在看concurrent包的知识,看到LinkedBlockingQueue,发现一篇好文推荐给大家.原文地址:[细谈Java并发]谈谈LinkedBlockingQueue 1.简介 上篇我们介 ...

  10. [Cypress] Find Unstubbed Cypress Requests with Force 404

    Requests that aren't stubbed will hit our real backend. To ensure we've stubbed all our routes, we c ...