先提供一个官方文档地址:https://cloud.spring.io/spring-cloud-gateway/reference/html/
漏掉一个
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
application.yml
spring:
application:
name: lrkj-gateway
profiles:
active: dev
application-dev.yml
spring:
application:
name: lrkj-gateway
thymeleaf:
mode: LEGACYHTML5
cache: false
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
security:
basic:
enabled: true
redis:
host: 192.168.1.63
password:
port: 6379
timeout: 3000
database: 10
cloud:
gateway:
routes:
- id: busine
uri: lb://lrkj-busine
predicates:
- Path=/busine/**
- id: userInfo
uri: lb://lrkj-user
predicates:
- Path=/userInfo/**
loadbalancer:
ribbon:
enabled: false
server:
port: 8610
#zuul:
# sensitive-headers:
# host:
# maxTotalConnections: 100000
# maxPerRouteConnections: 10000
# semaphore:
# maxSemaphores: 15000
# routes:
# busine:
# path: /busine/**
# serviceId: xxcy-busine
# user:
# path: /userInfo/**
# serviceId: xxcy-user
#
#ribbon:
# eureka:
# enabled: true
# ReadTimeout: 6000 #请求处理的超时时间
# ConnectTimeout: 2000 #请求连接的超时时间
# MaxAutoRetries: 1 #对当前实例的重试次数
# MaxAutoRetriesNextServer: 1 #切换实例的重试次数
# OkToRetryOnAllOperations: false #对所有操作请求都进行重试
#
#hystrix:
# threadpool:
# default:
# coreSize: 1000 ##并发执行的最大线程数,默认10
# maxQueueSize: 1000 ##BlockingQueue的最大队列数
# queueSizeRejectionThreshold: 500 ##即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
# command:
# default:
# execution:
# isolation:
# thread:
# timeoutInMilliseconds: 33000
eureka:
instance:
statusPageUrlPath: /info
healthCheckUrlPath: /health
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
# docker 部署开启
# prefer-ip-address: true
# ip-address: 127.0.0.1
client:
serviceUrl:
defaultZone: http://localhost:8600/eureka
logging:
level:
root: WARN
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
loggerLevel: basic
system:
ip: 192.168.1.63