时间:2022-12-29 10:51:04 | 栏目:JAVA代码 | 点击:次
在微服务项目使用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对象没有 空的构造器
加上 空的构造器即可。
类上面加
@AllArgsConstructor
@NoArgsConstructor