1. 程式人生 > >Java 物件之間相同屬性的賦值

Java 物件之間相同屬性的賦值

參考文章

1.BeanUtils.copyProperties

import org.springframework.beans.BeanUtils;
User src = new User();
User dest = new User();
BeanUtils.copyProperties(dest, src);

可以進行型別轉換

2.PropertyUtils.copyProperties

不會進行型別轉換