SpringCloud教程 | 第九篇: 使用API Gateway

1、参考资料

SpringCloud基础篇-10-服务网关-Gateway_springcloud gateway-CSDN博客

2、先学习路由,参考了5.1

2.1、建了一个cloudGatewayDemo,这是用来配置网关的工程,配置如下:

http://localhost:18080/aaa/name

该接口代码如下:

2.2、另外建了一个服务providerDemo,用来被路由过来的。

要验证的接口内容如下:

2.3、启动了这2个服务,然后访问http://localhost:18080/aaa/name

发现只在cloudGatewayDemo的控制台打印了日志,并未在另外一个服务providerDemo中有日志打印。

这就说明路由没生效。怎么解决这个问题呢?使路由生效,访问http://localhost:18080/aaa/name

然后路由到http://localhost:18082/aaa/name

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-18 21:14:01       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-18 21:14:01       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-18 21:14:01       57 阅读
  4. Python语言-面向对象

    2024-07-18 21:14:01       68 阅读

热门阅读

  1. Vue.js 内置指令

    2024-07-18 21:14:01       24 阅读
  2. SSH登录,设置欢迎信息

    2024-07-18 21:14:01       19 阅读
  3. DP讨论——访问者模式

    2024-07-18 21:14:01       23 阅读
  4. 批量调整图片分辨率

    2024-07-18 21:14:01       22 阅读
  5. Scala学习笔记18: Either 类型

    2024-07-18 21:14:01       23 阅读
  6. org.quartz.SchedulerException: Couldn‘t get host name!

    2024-07-18 21:14:01       18 阅读
  7. Linux中的文件夹作用

    2024-07-18 21:14:01       22 阅读
  8. 子树的重心

    2024-07-18 21:14:01       22 阅读
  9. 网站流量统计分析工具之plausible.io

    2024-07-18 21:14:01       22 阅读
  10. 设计模式--享元模式

    2024-07-18 21:14:01       21 阅读