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
相关推荐
步行cgn14 小时前
Spring 全注解开发详解
java·后端·spring
Thomas.Sir17 小时前
第12课:Nacos 配置加密、版本回溯、配置监听 & 生产风控方案
spring cloud·nacos
ZealSinger18 小时前
Spring7 RestTemplate弃用迁移
java·spring·后端开发·restclient
萧瑟余晖18 小时前
Spring 资源与环境配置体系详解
spring
不才不才不不才19 小时前
Spring 源码系列(29): 20 道高频面试题源码级解析合集
java·后端·spring
卓怡学长1 天前
w192基于springboot“考研情报站”微信小程序设计与实现
java·spring boot·spring·微信小程序·intellij-idea
步行cgn1 天前
Spring AOP 切面的先后顺序详解
java·spring
贾斯汀frank1 天前
Spring Boot + K8s + Istio 与 Spring Cloud:微服务治理能力对比
spring cloud·微服务·istio
小白的码BUG之路1 天前
Docker -- 构建ruoyi-gateway镜像
docker·容器·gateway
小尹哥-程序员1 天前
第6集:RAG检索不准?3个参数调优路线图
人工智能·spring