spring cloud feign调用返回404,处理记录
==> [http-nio-9009-exec-6] ==> ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.FeignException: status 404 reading xxxx; content:
{"timestamp":"2020-08-12T08:15:00.438+0000","status":404,"error":"Not Found","message":"No message available","path":"/a pi/xxx"}] with root cause
feign.FeignException: status 404 reading xxxFeign#xxx; content:
{"timestamp":"2020-08-12T08:15:00.438+0000","status":404,"error":"Not Found","message":"No message available","path":"/xxx/xx"}
at feign.FeignException.errorStatus(FeignException.java:60)
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:89)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:143)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:102)
at com.sun.proxy.$Proxy98.queryByPage(Unknown Source)
错误原因:响应结果找不到
解决办法:
1,接口声明处需要使用 @RestController 注解
2,方法声明上需要使用@RequestMapping,来声明方法是post还是get