BeanUtils 工具

89 阅读1分钟

copyProperties 拷贝

区分:有两种拷贝的方法,使用参数不相同,注意导包

//org.springframework.beans.BeanUtils    	//source被复制,粘贴到target
public static void copyProperties(Object source, Object target){....} 

//org.apache.commons.beanutils.BeanUtils	//orig被复制,粘贴到dest
public static void copyProperties(Object dest,Object orig){....}

在 org.springframework.beans.BeanUtils 包下的 copyProperties 第一个参数是被 copy 的对象

而 org.apache.commons.beanutils.BeanUtils 中是第二个参数。