SpringCloud組件相關錯誤


集成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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM