1.简介
网关作为流量的入口,常用功能包括路由转发、权限校验、限流控制。
spring:cloud:gateway:routes:- id: test_routeuri: http://www.baidu.compredicates:
#访问的路径就是 如果是/hello?url=baidu 就转发到 https://www.baidu.com/hello?url=baidu- Query=url,https://www.baidu.com- id: test1_routeuri: http://www.hao123.compredicates:- Query=url,hao123
bootstrap.yml
spring:application:name: gulimall-gatewaycloud:nacos:config:server-addr: 192.168.2.36:8848namespace: 255b4d7d-a41d-4340-b4e0-8fcb111fc978group: devfile-extension: yaml
nacos config
spring:application:name: gulimall-gatewaycloud:nacos:discovery:server-addr: 192.168.2.36:8848
server:port: 88
导入的依赖
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency>
详细的后面在介绍