分析原因: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(){}