使用spring的BeanUtils工具类

将B对象的属性值拷贝到A对象相同字段上
BeanUtils.copyProperties(new A(),new B())