第七章集成spring cloud alibaba集成 Gateway

1:首先了解一下什么是Gatway
Spring Cloud Gateway 是 Spring 官方基于 Spring 5.0,Spring Boot 2.0 和 Project Reactor 等技术开发的网关,Spring Cloud Gateway 旨在为微服务架构提供一种简单而有效的统一的 API 路由管理方式。Spring Cloud Gateway 作为 Spring Cloud 生态系中的网关,目标是替代 Netflix ZUUL,其不仅提供统一的路由方式,并且基于 Filter 链的方式提供了网关基本的功能,例如:安全,监控/埋点,和限流等。
注:说了Gatway是为了替代ZUUL的那么就简单介绍一下Gatway的一点限制。
1:Gatway必须需要SpringBoot2.X才能支持
2:Gatway底层依赖实现Netty和WebFulx,不同于我们servelt编程模型。
3: 基于第二点,所以我们不能以tomcat这类容器来运行,及在项目中我们不要把其打包成war包建议打包成jar包。
2:讲完概念我们直接上手写代码新建项目spring-cloud-alibaba-study-gatway步骤直接参考生产者。
2.1 pom文件修改(切记不能引入web包)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>com.hyl.study</groupId>
      <artifactId>spring-cloud-alibaba-study</artifactId>
      <version>0.0.1-SNAPSHOT</version>
   </parent>
   <groupId>com.hyl.study</groupId>
   <artifactId>spring-cloud-alibaba-study-gatway</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>spring-cloud-alibaba-study-gatway</name>
   <description>Demo project for Spring Boot</description>

   <properties>
      <java.version>1.8</java.version
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值