1. gateway 引入 nacos 依赖,实现服务的注册发现
2. gateway 引入 loadbalancer 依赖,实现服务的负载均衡
This commit is contained in:
9
yudao-gateway/src/main/resources/application-local.yaml
Normal file
9
yudao-gateway/src/main/resources/application-local.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
server:
|
||||
port: 8888
|
||||
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
@@ -1,7 +1,10 @@
|
||||
server:
|
||||
port: 8888
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: gateway-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
cloud:
|
||||
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
|
||||
gateway:
|
||||
@@ -20,6 +23,6 @@ spring:
|
||||
filters: # 过滤器,对请求进行拦截,实现自定义的功能,对应 FilterDefinition 数组
|
||||
- StripPrefix=1
|
||||
- id: system-admin-api # 路由的编号
|
||||
uri: http://127.0.0.1:48080 # 路由的目标地址
|
||||
uri: lb://system-server
|
||||
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
||||
- Path=/admin-api/system/**
|
||||
|
||||
Reference in New Issue
Block a user