服务网关介绍
服务网关一.https://spring.io/projects/spring-cloud-gateway二.文档不用追求太新,2,2,9足以三.使用http://doc.ruoyi.vip/ruoyi-cloud/cloud/gateway.html1.添加依赖<dependency><groupId>org.springframework.cloud</group
·
服务网关
一.https://spring.io/projects/spring-cloud-gateway
二.文档不用追求太新,2,2,9足以
三.使用
http://doc.ruoyi.vip/ruoyi-cloud/cloud/gateway.html
1.添加依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
2.配置文件
server:
port: 8024
spring:
application:
name: ruoyi-gateway
cloud:
gateway:
routes:
# 系统模块
- id: capex-system
uri: http://localhost:9201/
predicates:
- Path=/system/**
filters:
- StripPrefix=1
3.加启动类
测试:
http://localhost:9201/config/list
不理想:
http://localhost:8024/system/config/list配置文件:
spring cloud gateway使用 uri: lb://方式配置时,服务名的特殊要求
第一种:ws(websocket)方式: uri: ws://localhost:9000
第二种:http方式: uri: http://localhost:8130/
第三种:lb(注册中心中服务名字)方式: uri: lb://brilliance-consumer
更多推荐
所有评论(0)