天天看点

Could not set property ‘roles‘ of ‘class com.lp.common.entity.domain.TUser‘ 异常处理问题描述原因分析:解决方案:

问题描述

在使用mybatis进行用户信息查询时,出现如下异常:

Could not set property 'roles' of 'class com.lp.common.entity.
domain.TUser'
           

网上资料基本说是property所对应的值 要和实体类的字段保持一致。

原因分析:

因此,我仔细检查了mapper.xml和实体类中role字段对应的类型不一样,一个是Set,一个是List

Could not set property ‘roles‘ of ‘class com.lp.common.entity.domain.TUser‘ 异常处理问题描述原因分析:解决方案:
Could not set property ‘roles‘ of ‘class com.lp.common.entity.domain.TUser‘ 异常处理问题描述原因分析:解决方案:

解决方案:

把实体类中的role类型修改为List则可
Could not set property ‘roles‘ of ‘class com.lp.common.entity.domain.TUser‘ 异常处理问题描述原因分析:解决方案: