欢迎访问Spring Cloud中国社区

《重新定义Spring Cloud实战》由Spring Cloud中国社区倾力打造,基于Spring Cloud的Finchley.RELEASE版本,本书内容宽度足够广、深度足够深,而且立足于生产实践,直接从生产实践出发,包含大量生产实践的配置。欢迎加微信Software_King进群答疑,国内谁在使用Spring Cloud?欢迎登记

SpringCloud使用Feign访问URL出现404

yangyangwang · 3月前 · 1050 ·

SpringCloud使用Feign访问URL出现404

这个是feign 接口

  1. @FeignClient(value = "MICROSERVICECLOUD-DEPT")
  2. public interface DeptClientService {
  3. @RequestMapping(value = "/consumer/dept/get/{id}", method = RequestMethod.GET)
  4. public Dept get(@PathVariable("id") Long id);
  5. @RequestMapping(value = "/consumer/dept/list", method = RequestMethod.GET)
  6. public List<Dept> list();
  7. @RequestMapping(value = "/consumer/dept/add", method = RequestMethod.POST)
  8. public boolean add(Dept dept);
  9. }

在访问 http://localhost/consumer/dept/list 出现
报错信息

  1. feign.FeignException: status 404 reading DeptClientService#list(); content:
  2. {"timestamp":1534497184976,"status":404,"error":"Not Found","message":"Not Found","path":"/consumer/dept/list"}


注册中心已经注册服务