在微服务项目使用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对象没有 空的构造器 

 加上 空的构造器即可。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐