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
相关推荐
尚学教辅学习资料2 小时前
Ruoyi-vue-plus-5.x第五篇Spring框架核心技术:5.1 Spring Boot自动配置
vue.js·spring boot·spring
晚安里3 小时前
Spring 框架(IoC、AOP、Spring Boot) 的必会知识点汇总
java·spring boot·spring
上官浩仁3 小时前
springboot ioc 控制反转入门与实战
java·spring boot·spring
deepwater_zone3 小时前
Spring 微服务
spring·微服务
IT·陈寒9 小时前
怎么这么多 StringUtils —— Apache、Spring、Hutool 全面对比
java·spring·apache
青鱼入云9 小时前
【面试场景题】spring应用启动时出现内存溢出怎么排查
spring·面试·职场和发展
杨杨杨大侠13 小时前
实战案例:商品详情页数据聚合服务的技术实现
java·spring·github
杨杨杨大侠13 小时前
实战案例:保险理赔线上审核系统的技术实现
java·spring·github
小马爱打代码1 天前
Spring Cloud LoadBalancer 核心原理
spring cloud
FrankYoou1 天前
Spring Boot + Spring MVC 项目结构
spring boot·spring·springmvc