gateway配置

This commit is contained in:
bunny 2025-05-27 13:02:40 +08:00
parent 7960a6f879
commit 0bbe4ec39e
3 changed files with 20 additions and 1 deletions

View File

@ -65,6 +65,10 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId> <artifactId>spring-cloud-starter-gateway</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,12 @@
spring:
cloud:
gateway:
routes:
- id: order-route
uri: lb://service-order
predicates:
- Path=/api/order/**
- id: product-route
uri: lb://service-product
predicates:
- Path=/api/product/**

View File

@ -2,8 +2,11 @@ server:
port: 8888 port: 8888
spring: spring:
profiles:
include:
- route
application: application:
name: gateway name: gateway
cloud: cloud:
nacos: nacos:
server-addr: 192.168.3.150:8848 server-addr: 192.168.3.150:8848