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
相关推荐
AI小码13 小时前
LLM 应用的缓存工程:当每次 API 调用都在燃烧成本
java·人工智能·spring·计算机·llm·编程·api
Hui Baby14 小时前
Spring Security
java·后端·spring
Geek-Chow15 小时前
微服务认证与授权: 12 — JWKS 深入解析
spring·微服务·安全架构
编程(变成)小辣鸡16 小时前
Spring事务失效场景
java·后端·spring
一路向北North20 小时前
Spring Security OAuth2.0(18):资源服务测试
java·后端·spring
ahauedu1 天前
多租户 RAG 知识库系统基于Spring Boot 4.0.5+Spring AI 2.0.0 + Milvus
spring·rag·springai2.0
一路向北North1 天前
Spring Security OAuth2.0(19):JWT令牌
java·后端·spring
卓怡学长1 天前
w268基于springboot + vue 物流系统
java·数据库·vue.js·spring boot·spring·intellij-idea
ACGkaka_1 天前
Spring Boot 实战(四十二):集成 Spring AI 六大场景
人工智能·spring boot·spring
卓怡学长2 天前
w269基于spring boot + vue 候鸟监测数据管理系统
java·数据库·spring boot·spring·intellij-idea