本文主要是介绍springcloud| springcloud gateway (一),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Spring Cloud Gateway 是 Spring Cloud 的一个全新项目,该项目是基于 Spring 5.0,Spring Boot 2.0 和 Project Reactor 等技术开发的网关,它旨在为微服务架构提供一种简单有效的统一的 API 路由管理方式。
Spring Cloud Gateway 作为 Spring Cloud 生态系统中的网关,目标是替代 Netflix Zuul,其不仅提供统一的路由方式,并且基于 Filter 链的方式提供了网关基本的功能,例如:安全,监控/指标,和限流。
0.前言: 什么是网关?
大家都知道,从一个房间走到另一个房间,必然要经过一扇门。同样,从一个网络向另一个网络发送信息,也必须经过一道“关口”,这道关口就是网关。顾名思义,网关(Gateway).
1.如何引入 Spring Cloud Gateway?
要在项目中引入 Spring Cloud Gateway,请使用如下依赖:
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency>
有关使用当前的 Spring Cloud Release Train 设置构建系统的详细信息,请参阅 Spring Cloud Project页面。
如果已经引入了 Spring Cloud Gateway 项目,但不希望启用 gateway功能,请设置spring.cloud.gateway.enabled
的值为false。
Spring Cloud Gateway基于Spring Boot 2.x,Spring WebFlux和**Project Reactor
构建的。作为结果,当您在使用Spring Cloud Gateway时,许多您熟悉的同步库(例如,Spring Data和Spring Security)和模式**可能不适用。如果您不熟悉这些项目,建议您在使用Spring Cloud Gateway之前先阅读它们的文档以熟悉一些新概念。
参考:
http://www.ityouknow.com/springcloud/2018/12/12/spring-cloud-gateway-start.html
https://cloud.tencent.com/developer/article/1403887
这篇关于springcloud| springcloud gateway (一)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!