今天使用feign面向接口,实现springcloud负载均衡出错了,如下图,访问的地址 localhost/consumer/dept/list

feign.FeignException: status 404 reading DeptClientService#queryAll()

feign.FeignException: status 404 reading DeptClientService#queryAll()

解决方案:

看自己的注册中心名字是否和@FeignClient是否匹配

feign.FeignException: status 404 reading DeptClientService#queryAll()
feign.FeignException: status 404 reading DeptClientService#queryAll()

如果正确,检查自己的Mapping是否正确

feign.FeignException: status 404 reading DeptClientService#queryAll()

感觉自己都没有问题,我再次启动项目,发现还是一样的错,这时候我 继续localhost/consumer/dept/list 还是报错,于是我试了一下localhost/consumer/dept/get/1,发现

feign.FeignException: status 404 reading DeptClientService#queryAll()发现正确。于是我知道是我的路径错了,最后发现这个接口的Mapping地址必须和服务提供者的Mapping地址一样
feign.FeignException: status 404 reading DeptClientService#queryAll()
feign.FeignException: status 404 reading DeptClientService#queryAll()

改成一样的就解决问题了

feign.FeignException: status 404 reading DeptClientService#queryAll()
脑壳疼!!!

相关文章:

  • 2021-05-29
  • 2022-12-23
  • 2022-01-20
  • 2021-12-23
  • 2021-09-30
  • 2021-04-16
  • 2021-07-01
猜你喜欢
  • 2021-12-04
  • 2021-11-12
  • 2022-12-23
  • 2021-04-02
  • 2021-12-29
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案