# hystrix 超時時間最好大於Ribbon ReadTimeout+ConnectTimeout的超時時間
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 30000
#對當前實例的重試次數
#切換實例的重試次數
#請求處理的超時時間
#請求連接的超時時間
#對所有操作請求都進行重試
ribbon:
MaxAutoRetries: 1
MaxAutoRetriesNextServer: 1
ReadTimeout: 5000
ConnectTimeout: 2000
OkToRetryOnAllOperations: true
我在配置了 Zuul的 熔斷和重試以後 ,一直到ribbo超時後就直接返回錯誤編碼 hystrix不生效,經過板磚發現 需要在zuul中加入
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
加入就生效了