BeanUtils.copyProperties(a, b); 将一个对象的值赋值给另一个对象

import org.springframework.beans.BeanUtils;

BeanUtils.copyProperties(a, b);   // 将a的值赋值到b,自动识别相同的属性进行赋值

异常:

java.lang.IllegalArgumentException: null  // 非法参数异常、

1.在a赋值到b时,对象属性的类型不一致。Integer >> int, int不能存储null

2.其它同理

猜你喜欢

转载自blog.csdn.net/LZD30/article/details/86503536