Spring Cloud Gateway中的常见配置

问题

最近用到了Spring Cloud Gateway,这里记录一下这个服务的常见配置。

yaml 复制代码
spring:
  data:
    redis:
      host: ${REDIS_HOST:xxx.xxx.xxx.xxx}
      port: ${REDIS_PORT:2345wsd}
      password: ${REDIS_PASS:sdfsdfgh}
      database: ${REDIS_DB:8}
  session:
    redis:
      flush-mode: on_save
      namespace: mysystem:session
    timeout: P30D
  cloud:
    gateway:
      discovery:
        locator:
          # 服务名小写
          lower-case-service-id: true
          enabled: true
      routes:
        # 服务1
        - id: auth-svc
          uri: lb://auth-svc
          predicates:
            - Path=/auth/**
          filters:
            - StripPrefix=1
        # 服务2
        - id: system-svc
          uri: lb://system-svc
          predicates:
            - Path=/system/**
          filters:
            - StripPrefix=1
相关推荐
Bingo_BIG5 天前
Java Spring框架:单表的查询、新增、修改、删除、导入、导出
java·spring·前后端
paopaokaka_luck5 天前
智慧社区综合服务小程序(人脸识别、AI问答、Echarts图形化分析)
前端·javascript·spring boot·spring·数据分析·echarts
牧瀬クリスだ5 天前
YAML配置详解:SpringBoot实战指南
java·spring·yml
需要8265 天前
JVM 内存区域与对象创建:一次 GC 从哪来
java·jvm·spring boot·spring·servlet·tomcat
paopaokaka_luck5 天前
考研政治刷题小程序(AI推荐题目、ECharts数据分析、章节练习与专项训练、模拟考试、错题本与收藏夹、学习打卡与目标管理、题库和组卷维护)
前端·javascript·spring boot·spring·数据分析·echarts
步行cgn5 天前
Spring 基于 XML 的自动装配:byType 详解
java·后端·spring
边境悍匪5 天前
蜗牛学苑 Java 智能体学习 Day46|贯穿项目 2 思维导图复盘
java·开发语言·vue.js·学习·spring
步行cgn5 天前
Spring c 命名空间注入详解
java·后端·spring
Rain的Java大神之路5 天前
如何快速上传10G文件
java·spring boot·redis·后端·mysql·spring cloud·面试
需要8266 天前
MySQL 索引 B+ 树与“查询为什么变慢了
java·spring boot·spring·spring cloud·tomcat