Gateway

Gateway

1、多个服务

如果开发中有多个服务,怎么让前端或移动端调⽤⼀套接⼝?

2、Gateway是什么

Gateway就是微服务项⽬提供⼀种简单有效的统⼀的 API 路由管理⽅式并且可以对请求进⾏过滤处理。
优点
性能强劲,是Zuul的1.6倍 功能强⼤,内置了很多实⽤的功能,例如转发、监控、限流等设计优雅,容
易扩展
缺点
依赖Netty与WebFlux,不是传统的Servlet编程模型,有⼀定的学习成本不能在Servlet容器下⼯作,也
不能构建成WAR包,即不能将其部署在Tomcat、Jetty等Servlet容器⾥,只能打成jar包执⾏ 不⽀持Spring Boot 1.x, 需2.0及更⾼的版本

3、Gateway解决什么问题

1.png

4、Gateway实现服务匹配

Getway核⼼的作⽤:
1.服务路由匹配
2.png
2.pom.xml

    <dependencies>
<!--        注册-->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            <version>2021.1</version>
        </dependency>
<!--         -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-loadbalancer</artifactId>
        </dependency>
<!--      gateway  -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>
<!--       公告 -->
        <dependency>
            <groupId>com.kou</groupI
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kkkouz

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值