当前位置:   article > 正文

OpenFeign Could not extract response: no suitable HttpMessageConverter found for response type 问题解决_feign.codec.decodeexception: could not extract res

feign.codec.decodeexception: could not extract response

问题描述:

feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter found for response type [com.common.util.Result<com.entity.User>] and content type [text/html]

问题分析:

1、调用接口地址与被调用接口地址不一致,导致报错。

被调用的接口:

  1. @RestController
  2. @RequestMapping("/test")
  3. public class TestController {
  4. @GetMapping("/test1")
  5. public Result<User> test1() {
  6. int i = 1 / 0;
  7. return Result.success("操作成功");
  8. }
  9. }

调用接口:

  1. @GetMapping("/test1")
  2. Result<User> test1();

解决办法:调用接口地址和被调用接口地址保持一致即可。

  1. @GetMapping("/test/test1")
  2. Result<User> test1();

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/813930
推荐阅读
相关标签
  

闽ICP备14008679号