這兩個類在不同的包下面,而這兩個類的copyProperties()方法里面傳遞的參數賦值是相反的。
例如:
a,b為對象
BeanUtils.copyProperties(a, b);
BeanUtils是org.springframework.beans.BeanUtils, a拷貝到b
public static void copyProperties(Object source, Object target)//source 源文件,target 目標文件 throws BeansException { copyProperties(source, target, null, (String[])null); }
BeanUtils是org.apache.commons.beanutils.BeanUtils,b拷貝到a
public static void copyProperties(Object dest, Object orig)//dest(英譯:“蒸餾”,可理解為空白文件,目標文件),original原始的,源文件 throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().copyProperties(dest, orig); }