网关Gateway简介

【笔记于学习尚硅谷课程所作】

4.网关Gateway

​  网关作为流量的入口,常用功能包括路由转发、权限校验、限流控制等。而springcloud gateway作为SpringCloud官方推出的第二代网关框架,取代了Zuul网关。

在这里插入图片描述

4.1介绍

在这里插入图片描述

​ 当我们请求到达网关,网关利用断言来判定这次的请求是否符合某个路由规则,如果符合了就按这个路由规则路由到指定地方。在路由过程中要经过指定Filter进行过滤

4.2 创建API网关项目

1.创建时导入依赖

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>

2.加入到注册中心和配置中心

猜你喜欢

转载自blog.csdn.net/qq_41596568/article/details/106447678