- 2020-03-31【Spring Cloud】一个超简单的小例
- 2020-03-31【Spring Cloud】一个超简单的小例
- Spring Cloud Function现RCE 0-day漏
- Spring Cloud Eureka简介及与Zookeeper
- spring cloud(一) 从一个简单的springboot
- spring cloud(二) 起步,集成Eureka服务发现
- spring cloud(三)Eureka高可用性+Feign声
- spring cloud(四) Eureka配置Httpbasi
- Spring Cloud的基本认识和使用Spring Cloud
- Spring 5.x 、Spring Boot 2.x 、Spr
Spring Cloud Gateway提供了一个在Spring生态系统之上构建的API网关,包括:Spring 5,Spring Boot 2和Project Reactor。Spring Cloud Gateway旨在提供一种简单而有效的路由方式,并为它们提供一些网关基本功能,例如:安全,监控/指标和弹性。
一. 版本说明
Spring Boot版本:2.2.5.RELEASE
Spring Cloud版本:Hoxton.SR3
如无特殊说明,Spring Cloud的所有例程都将采用上面的版本。
二. 网关的使用
1. 新建父项目
1.1 使用简单Maven创建父项目:

选择Maven,选择jdk版本,单击“Next”

输入项目名称,及位置,单击“Finish”

1.2. 创建好后,打开pom.xml文件,加入如下代码:

1.3. 删除src文件夹
2. 创建网关子项目
2.1 在父项目下面,使用Spring Initializr新建网关子项目gateway,选择依赖Gateway,简略贴图如下:


建好后,修改pom.xml文件,修改后文件如下:

2.2 修改配置文件application.properties后缀为yml(即文件名改为application.yml),对网关进行配置
这里我们将csdn博客作为服务提供方

2.3 执行run,springboot内置Tomcat启动,端口9001

2.4 浏览器输入地址http://localhost:9001/huanzi833

如果你觉得本文章还算有用,请关注并点赞^_^,之后还会陆续上其他关于Spring Cloud的内容,谢谢
--------------------------
【高阶用法】一个实例教会你 Spring Boot 集成 Thymeleaf、MyBatis 完成产品的增删改查
网友评论