学无先后,达者为师

网站首页 编程语言 正文

Hutool cn.hutool.core.bean.BeanException: Set value of [xxx] error问题解决

作者:旭东怪 更新时间: 2022-02-26 编程语言

问题描述:

cn.hutool.core.bean.BeanException: Set value of [lastLoginTime] error!

问题分析:

1、在使用BeanUtil.copyProperties()方法时,lastLoginTime的类型不一致,导致报错。

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserVO{
    private String username;
    private LocalDate lastLoginTime;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDto {

    private String username;
    private LocalDateTime lastLoginTime;
}

解决办法:使lastLoginTime的类型一致即可

原文链接:https://blog.csdn.net/qq_38974638/article/details/123048244

栏目分类
最近更新