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

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

feign.FeignException: status 404 reading DeptClientService#queryAll()_第1张图片

feign.FeignException: status 404 reading DeptClientService#queryAll()_第2张图片

解决方案:

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

feign.FeignException: status 404 reading DeptClientService#queryAll()_第3张图片
feign.FeignException: status 404 reading DeptClientService#queryAll()_第4张图片

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

feign.FeignException: status 404 reading DeptClientService#queryAll()_第5张图片

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

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

改成一样的就解决问题了

在这里插入图片描述
脑壳疼!!!

你可能感兴趣的:(feign.FeignException: status 404 reading DeptClientService#queryAll())