在现在高版本的spring-cloud Hoxton.RELEASE环境中,使用hystrix熔断机制,一般都涉及到超时,一般设置:
ribbon:
eureka:
enable: true
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 12000
Spring Cloud Starter Hystrix (deprecated, please use spring-cloud-starter-netflix-hystrix)
在使用spring-cloud-starter-netflix-hystrix包时,上面的问题就出来了:
Cannot resolve configuration property 'hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds'
所以,就用这个设置:
<spring-boot.version>2.2.1.RELEASE</spring-boot.version> <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
在application.yml文件中:
feign: hystrix: enabled: false client: default-config: my-config config: my-config: connectTimeout: 25000 # 连接超时时间 readTimeout: 25000 # 读超时时间设置