Could not copy property 'id' from source to target异常

BeanUtils是web开发中经常用的一个工具类,当一个对象有十几个字段的话,通过这个可以快速实现~

异常信息:

Could not copy property 'id' from source to target; nested exception is java.lang.IllegalArgumentException


出现问题:在使用BeanUtils.copyProperties()方法时,如果javaBean中的属性含有基本类型,而model模型中对应的属性值为 null 的话,就会出现这个异常。


解决方法:javaBean中的属性值不要使用基本类型。


猜你喜欢

转载自blog.csdn.net/Jae_Wang/article/details/80568664