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
相关推荐
爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ1 小时前
Spring‑AI Document 对象 JSON 字段详解
人工智能·spring·json
麻雀聊技术2 小时前
一重启 AI 就失忆?用 Spring AI + PostgreSQL 3步搞定“长期记忆”持久化(附完整代码)
java·spring·openai
he___H3 小时前
Spring-Configur注解
java·spring
铃木之影4 小时前
Java 版本 RAG 示例(Spring AI + Milvus)
java·人工智能·spring
老白干5 小时前
基于 Spring AOP 的操作日志记录:以 DeptController 增删接口为例
java·python·spring
IKUN家族8 小时前
Spring MVC(五)
java·spring·mvc
一路向北North8 小时前
Spring AI(11) :ChatPDF-向量数据库、PDF处理、向量写入和向量搜索
数据库·人工智能·spring
markinmarkin20 小时前
Spring 中Bean 的作用域有哪些?
java·后端·spring
evans在进步1 天前
HashMap 为什么线程不安全?ConcurrentHashMap 如何解决?
java·spring boot·spring