BeanUtils.copyProperties导致出现问题,在一些情况可能报错。
数据源orig有一个参数是java.util.Date类型,没有初始化值,调用BeanUtils.copyProperties方法报错。
解决办法
1.在使用方法之前执行 ConvertUtils.register(new DateConverter(null), java.util.Date.class);
2.把org.apache.commons.beanutils.BeanUtils 替换成 org.springframework.beans.BeanUtils
特别需要注意
apache的包 使用 BeanUtils.copyProperties(new Object, orig); (对象,数据源)。
springframework的包 使用 BeanUtils.copyProperties(orig, new Object);(数据源,对象)。