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
相关推荐
leonkay1 小时前
C# 锁机制——【2】深入原理
开发语言·后端·spring·c#·个人开发
Raas1001 小时前
AI网关和大模型网关区别?MAI Gateway(魔芋企业级AI网关)如何实现AI流量统一治理
大数据·人工智能·gateway·ai网关·mai gateway·企业级产品
霸道流氓气质2 小时前
Spring AI 技术细节:RAG QuestionAnswerAdvisor 设计与实现
java·人工智能·spring
武子康6 小时前
Seedream 5.0 Pro 进入 Vercel AI Gateway:图像生成开始网关化
人工智能·ai·chatgpt·gateway·agent·claude·harness
Forerror20266 小时前
API网关怎么部署?MAI Gateway配置教程与最佳实践
人工智能·gateway·maigateway·finapi·企业级ai网关·大模型财务管控
重生之我是Java开发战士6 小时前
【Spring Cloud】认识微服务与工程搭建
spring·spring cloud·微服务
霸道流氓气质6 小时前
Spring AI 多模态开发指南:图片理解与语音合成
java·人工智能·spring
后台模板学习6 小时前
用 IM 即时聊天项目一次讲清消息去重算法的踩坑与解决方案
java·数据库·spring
Raas1006 小时前
AI网关和LLM网关区别?MAI Gateway(魔芋企业级AI网关)企业级方案对比指南
大数据·人工智能·gateway·mai gateway·企业级产品
JJJennie7777 小时前
大模型网关支持DeepSeek吗?MAI Gateway实战能力深度解读
gateway