先提供一個官方文檔位址: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