1,实现的效果,就是zuul 网关的配置路由实现负载均衡,zuul 的配置文件放在springcloud config 上

2,需要的服务如下:

3,其实就是配置下springcloud-zuul 的配置,连接到springcloud-config

maven:在原来的zuul 基础上,加上spring-config-client 和监控中心(手动刷新用的)

<!-- actuator监控中心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- springcloud config 2.0 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>

bootstrap.yml

spring:
application:
####注册中心应用名称
name: service-zuul
cloud:
config:
####读取后缀
profile: dev
####读取config-server注册地址
discovery:
service-id: config-server
enabled: true
#####eureka服务注册地址
eureka:
client:
service-url:
defaultZone: http://localhost:8100/eureka
server:
port: 80 #配置手动实时刷新
#managementendpoints.web.exposure.include=*
management:
endpoints:
web:
exposure:
include: "*"

git 上的配置文件如下:service-zuul-dev-yml

### 配置网关反向代理
zuul:
routes:
api-member:
### 以 /api-member/访问转发到会员服务
path: /api-member/**
serviceId: app-aiyuesheng-member
api-order:
### 以 /api-order/访问转发到订单服务
path: /api-order/**
serviceId: app-aiyuesheng-order

如果配置文件修改了,参照springcloud-config 手动刷新,只不过,他需要在启动类加上这个

    @RefreshScope
@ConfigurationProperties("zuul")
public ZuulProperties zuulProperties() {
return new ZuulProperties();
}

再通过post man 发送post 请求:

http://127.0.0.1/actuator/refresh

最新文章

  1. Windows OS上安装运行Apache Kafka教程
  2. swift3.0 创建一个app引导页面
  3. windows下上传文件到VWware的centos
  4. Android SDK 国内镜像
  5. Struts中的OGNL和EL表达式笔记
  6. 静态时序分析(static timing analysis)
  7. 【转】Android TouchEvent事件传递机制
  8. 24C01的IIC 讀寫的c51程式
  9. JavaEE中的MVC(一)Dao层彻底封装
  10. label按钮和文字对齐
  11. shell的进度条【转】
  12. 周一干货~手把手教你安装 Visual Studio 安卓模拟器
  13. mysql5.7 rpm安装教程
  14. neo4j---删除关系和节点
  15. 深度学习原理与框架-RNN网络架构-RNN网络 1.RNN的前向传播 2.RNN的反向传播
  16. SNP命名
  17. 树莓派与Arduino Leonardo使用NRF24L01无线模块通信之基于RF24库 (四) 树莓派单子节点查询
  18. MySQL&lt;多表操作&gt;
  19. JanusGraph Server配置
  20. [模板]KMP字符串匹配

热门文章

  1. PostgreSQL没有认证密码就登陆了缘由
  2. 当微信小程序遇上filter~
  3. python学习记录_IPython基础,Tab自动完成,内省,%run命令_
  4. 搭建flutter开发
  5. NLP(二十四)利用ALBERT实现命名实体识别
  6. Java原来还可以这么学:如何搞定面试中必考的集合类
  7. Hyperledger Fabric1.4环境搭建
  8. vue中数据请求的三种方法
  9. AX中Json转化成表记录
  10. nsq 初学使用日记