集成openfeign報錯:feign.FeignException$NotFound: status 404 reading
檢查前置條件
1:確定springboot啟動類的上面是否添加@EnableFeignClients注解
2:確定使用openfeign的接口上是否添加@FeignClient(value = "CLOUD-PAYMENT-SERVICE")注解
CLOUD-PAYMENT-SERVICE為注冊的服務名稱
調用方法接口上面的requetMapping中的url需為完整的url(controller的requetMapping+方法的requetMapping)
Feign在開啟Hystrix后,調用生產者接口時超時時間無效
feign:
hystrix:
enabled: true #如果處理自身的容錯就開啟。開啟方式與生產端不一樣。
client:
config:
default:
connectTimeout: 10000
readTimeout: 10000
hystrix:
shareSecurityContext: true
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 8000