关于feign.codec.DecodeException异常的解决方案

2022-07-16,,,

feign.codec.decodeexception异常

在微服务项目使用feign进行远程服务调用时,出现该异常:

feign.codec.decodeexception: type definition error: [simple type, class entity.result]; nested exception is com.fasterxml.jackson.databind.exc.invaliddefinitionexception: cannot construct instance of `entity.result` (no creators, like default construct, exist): cannot deserialize from object value (no delegate- or property-based creator) at [source: (pushbackinputstream); line: 1, column: 2]

报该错的原因是 构造的result对象没有 空的构造器 

 加上 空的构造器即可。

解决错误type definition error: [simple type, classxxx

类上面加

  • @allargsconstructor
  • @noargsconstructor

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

《关于feign.codec.DecodeException异常的解决方案.doc》

下载本文的Word格式文档,以方便收藏与打印。