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
相关推荐
代码or搬砖34 分钟前
TransactionManager 详解、常见问题、解决方法
java·开发语言·spring
廋到被风吹走40 分钟前
【Spring】Spring Context 详细介绍
java·后端·spring
banpu1 小时前
Spring相关
数据库·spring·sqlserver
Swift社区1 小时前
死锁:线程卡死不是偶然,而是设计问题
java·spring·maven
Roye_ack3 小时前
【微服务 Day2】SpringCloud实战开发(微服务拆分步骤 + Nacos注册中心 + OpenFeign + 微服务拆分作业)
java·spring cloud·微服务·nacos·openfeign
LJianK13 小时前
前后端接口常见传参
java·spring
YDS8294 小时前
SpringCloud —— 分布式事务管理Seata详解
分布式·spring·spring cloud·seata
小王师傅664 小时前
【轻松入门SpringBoot】actuator健康检查(中)
java·spring boot·spring
海南java第二人5 小时前
Spring事务注解@Transactional参数详解与实战指南
spring
努力的小郑5 小时前
Spring AOP + Guava RateLimiter:我是如何用注解实现优雅限流的?
后端·spring·面试