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
posted @ 2020-07-09 13:53  Erosions  阅读(650)  评论(0)    收藏  举报