Java DO到DTO转换利用spring 的BeanUtils.copyProperties() 

Java DO到DTO转换利用spring 的BeanUtils.copyPropertiesJava DO到DTO转换利用spring 的BeanUtils.copyProperties()_List

public static <T> List<T> copy(Object sourceList, Class<?> beanClass) throws Exception {
List<Object> sList = (List<Object>) sourceList;
List<Object> tList = new ArrayList<Object>();
for (Object t : sList) {
Object dto = beanClass.newInstance();
BeanUtils.copyProperties(t, dto);
tList.add(dto);
}
return (List<T>) tList;
}

List<DTO> dtoList = copy(doList,DTO.class);