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-2025 CODEPRJ.COM