Could not read JSON: Cannot construct instance of''类名""(no Creators, like default construct, exist)



分析原因:redis的这些序列化方式,使用的是无参构造函数进行创建对象set方法进行赋值,方法中存在有参的构造函数,默认存在的无参构造函数是不存在的(继承自object),必须显示的去重写.

有两种方式解决该问题:

(1)添加

@NoArgsConstructor 注解

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("消息推送返回类")
public class MessageStatisticsVO{
    @ApiModelProperty("标题")
    private String title;

    @ApiModelProperty("出库F0总计")
    private BigDecimal outF0;


    @ApiModelProperty("退货F0总计")
    private BigDecimal backF0;

    @ApiModelProperty("退货单总计")
    private Integer backOrders;

    @ApiModelProperty("新增订单总计")
    private Integer contracts;

     @ApiModelProperty("部门名称")
    private String deptName;

    public MessageStatisticsVO(Integer contracts, String deptName) {
        this.contracts = contracts;
        this.deptName = deptName;
    }

}

(2)添加一个无参构造方法

public MessageStatisticsVO(){}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 Cannot construct instance of `com.jty.entities.Dept` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator) redis序列化LocalDateTime时报错 报错信息:Could not read JSON: Cannot construct instance of `java.time.LocalDateTime` Redis反序列化错误Could not read JSON: Cannot construct instance of `java.util.ArrayList$SubList` Cannot construct instance of `com.**` (although at least one Creator exists) 关于传值报JSON parse error: Cannot deserialize instance 53-解决Maven提示:Could not read settings.xml, assuming default values Laravel - Property [title] does not exist on this collection instance Cannot assign to read only property 'exports' of object '#' ,文件名大小写问题!!! Could not find JSON in http://updates.jenkins-ci.org/update-center.json?id=default&version=2.7.4 Cannot read property 'apply' of undefined
 
粤ICP备18138465号  © 2018-2026 CODEPRJ.COM