不重启微服务的情况下更新配置

配置服务端

tensquare_config配置依赖

        <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency> tensquare_config配置application.yml server:
port: 9998
spring:
application:
name: tensquare‐config
cloud:
config:
server:
git:
uri: https://gitee.com/ld/tensquare-config.git
rabbitmq:
host: 192.168.211.128
username: guest
password: guest
management: #暴露触发消息总线的地址
endpoints:
web:
exposure:
include: bus-refresh

配置客户端

依赖

        <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency> <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> bootstrap.yml spring:
cloud:
config:
name: tensquare
profile: user
label: master
uri: http://127.0.0.1:9998 application.yml spring:
rabbitmq:
host: 192.168.211.128
username: guest
password: guest postman测试Url:localhost:9998/actuator/bus-refresh Method:post

自定义配置

在引入配置的地方添加注解:@RefreshScope

SpringCloudBus的更多相关文章

  1. SpringCloud学习之SpringCloudBus

    一.spring-cloud-bus是什么? 回答这个问题之前,我们先回顾先前的分布式配置,当配置中心发生变化后,我们需要利用spring-boot-actuator里的refresh端点进行手动刷新 ...

  2. SpringCloud系列十:SpringCloudConfig 高级配置(密钥加密处理(JCE)、KeyStore 加密处理、SpringCloudConfig 高可用机制、SpringCloudBus 服务总线)

    1.概念:SpringCloudConfig 高级配置 2.具体内容 在 SpringCloudConfig 之中考虑到所有配置文件都暴露在远程仓库之中的安全性问题,所以提供有安全访问的处理机制,这样 ...

  3. SpringCloud(八):springcloud-bus消息总线(刷新配置服务)

    Bus消息总线: 好了现在我们接着上一篇的随笔,继续来讲.上一篇我们讲到,我们如果要去更新所有微服务的配置,在不重启的情况下去更新配置,只能依靠spring cloud config了,但是,是我们要 ...

  4. SpringCloud-Bus 消息总线

    概述 基本介绍 Spring Cloud Bus 目前支持两种消息代理:RabbitMQ.Kafka Spring Cloud Config 配合 Spring Cloud Bus 使用可以实现配置的 ...

  5. spring-cloud-bus

    安装rabbitmq 依赖erlang: http://erlang.org/download/otp_win64_18.2.exe

  6. com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.6Xa99MDZTJyHKdPqMyoVEA' in

    项目启动报此异常,解决方式:用root权限登陆rabbitmq,admin处添加vhost

  7. 集成SpringCloudBus,但没有总线通知更改

    配置服务端别忘了添加以下2个依赖 implementation("org.springframework.cloud:spring-cloud-config-server")imp ...

  8. Spring Cloud官方文档中文版-Spring Cloud Config(下)-客户端等

    官方文档地址为:http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#_serving_alternative_formats 文中例子我做了 ...

  9. springBoot系列教程01:elasticsearch的集成及使用

    1.首先安装elasticsearch 集群环境,参考 http://www.cnblogs.com/xiaochangwei/p/8033773.html 注意:由于我的代码采用的是springbo ...

随机推荐

  1. Java泛型中extends和super的区别?

    <? extends T>和<? super T>是Java泛型中的"通配符(Wildcards)"和"边界(Bounds)"的概念. ...

  2. 笔记49 在Spittr应用中整合Hibernate

    在前边构建的Spittr应用中整合Hibernate 由于最近所学的hibernate都是使用xml方式进行配置的,所以在与以Java方式配置的Spittr应用结合时就会出现一些小问题,在此进行总结. ...

  3. TTreeView、TTreeNodes和TTreeNode

    TreeView是Delphi中使用频率比较高的一个控件,虽然使用次数很多,但总结不够.借着这次做GDW原型的机会总结一下,写的过程中也会参考网上的博文. TTreeView.TTreeNodes和T ...

  4. 暑假集训test-8-28

    大概是从我一年以来做过的最傻逼的一套题了.. 一个半小时打完三个程序三个暴力拍完以为自己AK了,开心地耍了两个小时. 结果T3要写高精,LL炸了后4个点,中间还有个点是啥都不选的,我没用0去更新又炸了 ...

  5. Metasploit 模块和位置

    Metasploit Framework由许多的模块组成的. 一.Exploits(漏洞模块) 定义为使用“有效载荷(payloads)”的模块 没有“有效载荷”的攻击是辅助模块 二.Payloads ...

  6. Git及github使用(一)客户端与本地关联

    一.下载安装git客户端 1.官网下载地址:https://git-scm.com/ 2.选择自己相应的系统进行下载即可(windows一路默认安装) 二.配置git 1.在github上注册自己的账 ...

  7. ECMAScript1.4 对象 | 简单数据类型与复杂数据类型 | 内置对象 | 基本包装类型 | String

    对象 函数和对象的区别: 函数:封装代码 对象:封装属性和方法 创建对象的方法: 1,对象字面量{} // 模拟创建一只dog var dog = { // 属性 name: 'puppy', age ...

  8. java-day12

    数据结构 常用的数据存储结构:栈,队列,数组,列表,红黑树. 栈:先进后出(入口和出口在用一侧) 队列:先进先出 数组: 查询快:因为数组的地址是连续的,通过数组的首地址找到数组中的元素. 增/删慢: ...

  9. python简介与安装

    Python简介和环境搭建 于 20世纪80年代末,Guido van Rossum发明了Python,初衷据说是为了打发圣诞节的无趣.1991年首次发布,是ABC语言的继承,同时也是一种脚本语言.取 ...

  10. PyTorch中,关于model.eval()和torch.no_grad()

    一直对于model.eval()和torch.no_grad()有些疑惑 之前看博客说,只用torch.no_grad()即可 但是今天查资料,发现不是这样,而是两者都用,因为两者有着不同的作用 引用 ...