1. spring cloud config配置记录

1.1. pom

<!-- 分布式配置中心 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

1.2. 创建bootstrap.yml

  1. 配置eureka和config相关配合
spring:
application:
name: carer
cloud:
config:
uri: http://i.xxx.com:8888
profile: dev
username: dev
password: xxxx
eureka:
instance:
appname: carer-test
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://dev:xxxx@i.tzxylao.com:8761/eureka/
  1. 其他配置全部移至application-dev.properties和application.pro.properties

1.3. 配置刷新

1.3.1. 添加注解

  1. 添加@RefreshScope注解
  2. example
@Component
@RefreshScope
public class SysConfig { @Value("${openTradeTest}")
private String openTradeCode; @Value("${sysId}")
private String sysId; @Value("${authUrl}")
private String authUrl; public String getOpenTradeCode() {
return openTradeCode;
} public void setOpenTradeCode(String openTradeCode) {
this.openTradeCode = openTradeCode;
} public String getSysId() {
return sysId;
}
}

1.3.2. 添加pom

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

1.3.3. 配置

spring.rabbitmq.virtual-host=xxx
spring.rabbitmq.addresses=localhost:5672
spring.rabbitmq.username=xxx
spring.rabbitmq.password=***

上述两个步骤在服务端和客户端都得做

1.3.4. 刷新

  1. 调用 localhost:8888/bus/refresh 实现连接同一个服务的所有相同客户端配置刷新

1.4. 自动刷新

1.4.1. gitlab上配置



2. 最后记得add Webhook按钮点下添加

3. 因为设置了登录密码,填写地址的时候,可以这样

http://username:password@localhost:8888/bus/refresh

spring cloud config配置记录的更多相关文章

  1. Spring Cloud Config 配置刷新

    客户端进行刷新操作. 1.添加 actuator包,这样 /refresh url才处于可用状态. <dependency> <groupId>org.springframew ...

  2. 跟我学SpringCloud | 第七篇:Spring Cloud Config 配置中心高可用和refresh

    SpringCloud系列教程 | 第七篇:Spring Cloud Config 配置中心高可用和refresh Springboot: 2.1.6.RELEASE SpringCloud: Gre ...

  3. 微服务SpringCloud之Spring Cloud Config配置中心Git

    微服务以单个接口为颗粒度,一个接口可能就是一个项目,如果每个项目都包含一个配置文件,一个系统可能有几十或上百个小项目组成,那配置文件也会有好多,对后续修改维护也是比较麻烦,就和前面的服务注册一样,服务 ...

  4. 微服务SpringCloud之Spring Cloud Config配置中心服务化

    在前面两篇Spring Cloud Config配置中心的博客中都是需要指定配置服务的地址url:spring.cloud.config.uri,客户端都是直接调用配置中心的server端来获取配置文 ...

  5. spring cloud --- config 配置中心 [本地、git获取配置文件]

    spring boot      1.5.9.RELEASE spring cloud    Dalston.SR1 1.前言 spring cloud config 配置中心是什么? 为了统一管理配 ...

  6. Spring Cloud Config 配置中心高可用

    详细参见 <Spring Cloud 与 Docker微服务架构实战> p163-9.10 Spring Cloud Config 与 Eureka 配合使用 p163-9.12 Conf ...

  7. Spring Cloud Config 配置中心 自动加解密功能 jasypt方式

    使用此种方式会存在一种问题:如果我配置了自动配置刷新,则刷新过后,加密过后的密文无法被解密.具体原因分析,看 SpringCloud 详解配置刷新的原理 使用  jasypt-spring-boot- ...

  8. Spring Cloud Config 配置中心

    请将远程配置文件的格式写对: 比如使用 *.yml 或者 *.properties yml: testconfig: testvalue properties: testconfig=testvalu ...

  9. spring cloud config配置

    参考: http://www.ityouknow.com/springcloud/2017/05/22/springcloud-config-git.html http://www.ityouknow ...

随机推荐

  1. 14. Redis配置统计字典

    14. Redis配置统计字典14.1 info系统状态说明14.1.1 命令说明14.1.2 详细说明14.2 standalone配置说明和分析14.2.1 总体配置14.2.2 最大内存及策略1 ...

  2. BFC是什么及能用它能做什么

    最近较为频繁的碰到了一个新的名词:BFc,每次都可以在相关的技术博客里面看到对其的简单介绍,刚开始以为自己懂了,但实际上没懂,今天就来搞清楚它到底是什么,以及我们能用他做什么? BFC:全名为 Blo ...

  3. 洛谷P3916||图的遍历||反向建图||链式前向星||dfs

    题目描述 给出 NN 个点, MM 条边的有向图,对于每个点 vv ,求 A(v)A(v) 表示从点 vv 出发,能到达的编号最大的点. 解题思路 看起来很简单的一道题, 但我依然调了一天,我还是太菜 ...

  4. matplotlib -- 基础知识

    matplotlib 组织图表的方式 最上层是一个 Figure 实例,包含了所有可见的和其他一些不可见的内容.该 Figure 实例包含了一个 Axes 实例的成员属性 Figure.axes,同时 ...

  5. 用Python语言开发VTK程序的步骤

    在Windows环境下用Python语言开发VTK程序 1.安装Python集成开发环境IDLE:下载地址:https://www.python.org/downloads/ 2.然后到VTK官网下载 ...

  6. C#读取word内容实践

    C#读取word文档是如何实现的呢?我们可以使用FileStream对象来把文本文件里面的信息读取出来,但是对于word文档来说就不能使用这样的方法了. 这种情况下C#读取word文档的实现我们需要使 ...

  7. 分别求二叉树前、中、后序的第k个节点

    一.求二叉树的前序遍历中的第k个节点 //求先序遍历中的第k个节点的值 ; elemType preNode(BTNode *root,int k){ if(root==NULL) return ' ...

  8. springboot pom.xml记

    本文包括: springboot 基本pom.xml配置 热部署 配置打包插件 maven pom.xml配置详解 1. springboot 基本pom.xml配置 <project xmln ...

  9. STL之vector容器详解

    vector 容器 vector是C++标准模版库(STL,Standard Template Library)中的部分内容.之所以认为是一个容器,是因为它能够像容器一样存放各种类型的对象,简单的说: ...

  10. 利用insertd查出更新记录

    DROP TABLE #tableCREATE TABLE #table(CompanyID VARCHAR(20),BillNo VARCHAR(40))UPDATE dbo.SD_Inv_Move ...