首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Spring Cloud【Finchley】-15 查看Zuul的路由端点和过滤器

Spring Cloud【Finchley】-15 查看Zuul的路由端点和过滤器

作者头像
小小工匠
发布2021-08-17 15:40:19
发布2021-08-17 15:40:19
7310
举报
文章被收录于专栏:小工匠聊架构小工匠聊架构

文章目录

概述

官网: https://cloud.spring.io/spring-cloud-static/Finchley.SR2/single/spring-cloud.html#_management_endpoints


确认spring-boot-starter-actuator依赖

默认情况下,我们引入的spring-cloud-starter-netflix-zuul依赖会自动的引入spring-boot-starter-actuator,所以无需重复引入


application.yml配置启用所有的监控端点

增加如下配置

代码语言:javascript
复制
#actuator  启用所有的监控端点 “*”号代表启用所有的监控端点,可以单独启用,例如,health,info,metrics
#  spring boot 升为 2.0 后,为了安全,默认 Actuator 只暴露了2个端点,heath 和 info
management:
  endpoints:
    web:
      exposure:
        include: "*" 
  endpoint:
      health:
        show-details: ALWAYS

启动服务

  1. 启动注册中心Eureka Server 项目 microservice-discovery-eureka
  2. 启动服务提供者micorservice-provider-user
  3. 启动服务消费者 micorservice-consumer-movie-ribbon
  4. 启动zuul网关microservice-gateway-zuul

访问 eureka server http://localhost:8761/ 查看注册情况


查看 Routes Endpoint

如官方解读,使用GET方法访问该端点,可以查看zuul当前映射的路由列表

使用POST方法访问该端点就会强制刷新zuul当前映射的路由列表。

通过下面的注释也可以知道

尽管路由会自动刷新,但是Spring Cloud依然提供了强制立即刷新的功能。

访问zuul

http://localhost:4534/actuator/routes

zuul默认情况下会代理所有注册在EurekaServer上的服务


查看 Filters Endpoint

访问zuul

http://localhost:4534/actuator/filters


代码

https://github.com/yangshangwei/SpringCloudMaster/tree/master/microservice-gateway-zuul

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/01/12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 概述
  • 确认spring-boot-starter-actuator依赖
  • application.yml配置启用所有的监控端点
  • 启动服务
  • 查看 Routes Endpoint
  • 查看 Filters Endpoint
  • 代码
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档