feign.codec.DecodeException异常如何解决

2023-05-05,,

本篇内容主要讲解“feign.codec.DecodeException异常如何解决”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“feign.codec.DecodeException异常如何解决”吧!

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异常如何解决”有了更深的了解,不妨来实际操作一番吧!这里是本站网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

《feign.codec.DecodeException异常如何解决.doc》

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