最近涉及到了在 copyProperties 遇见了一些问题,从Dto 到 Vo的拷贝出现了问题(参数名相同,类型不一致)
使用BeanUtils
实现属性拷贝,在类型不同时,会忽略 target
对象相同命名参数的,而 Hutool
提供的BeanUtil则不会忽略
下面是我的测试代码
import cn.hutool.core.bean.BeanUtil;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
public class HutoolPractice {
@Test
public void copyPropertie() {
Dto dto = new