1.簡介
網(wǎng)關(guān)作為流量的入口,常用功能包括路由轉(zhuǎn)發(fā)、權(quán)限校驗、限流控制。
spring:
cloud:
gateway:
routes:
- id: test_route
uri: http://www.baidu.com
predicates:
#訪問的路徑就是 如果是/hello?url=baidu 就轉(zhuǎn)發(fā)到 https://www.baidu.com/hello?url=baidu
- Query=url,https://www.baidu.com
- id: test1_route
uri: http://www.hao123.com
predicates:
- Query=url,hao123
bootstrap.yml
spring:
application:
name: gulimall-gateway
cloud:
nacos:
config:
server-addr: 192.168.2.36:8848
namespace: 255b4d7d-a41d-4340-b4e0-8fcb111fc978
group: dev
file-extension: yaml
nacos config
spring:
application:
name: gulimall-gateway
cloud:
nacos:
discovery:
server-addr: 192.168.2.36:8848
server:
port: 88
導入的依賴文章來源:http://www.zghlxwxcb.cn/news/detail-843829.html
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
詳細的后面在介紹文章來源地址http://www.zghlxwxcb.cn/news/detail-843829.html
到了這里,關(guān)于分布式組件 gateway 網(wǎng)關(guān)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!