springframework.beans.BeanUtils.copyProperties()方法注意事项

springframework.beans.BeanUtils.copyProperties()方法注意事项

copyProperties方法中,若source 和 target 的属性复制是通过属性名进行复制,但是如果属性名相同但属性类型不一致,也无法成功复制;

 public static void copyProperties(Object source, Object target) throws BeansException {
        copyProperties(source, target, (Class)null, (String[])null);
    }

示例

Account类

AccountVO类

测试