正文:

a,b为对象

BeanUtils.copyProperties(a,  b);

1,BeanUtils是org.springframework.beans.BeanUtils, a拷贝到b

2,BeanUtils是org.apache.commons.beanutils.BeanUtils,b拷贝到a

注:

我用的是1;

ab之间不需要有什么关联,相同命名相同类型的字段的值会复制过去

参考博客:

1,关于BeanUtils.copyProperties() 用法及区别 - 、刘三好的程序旅途 - CSDN博客

https://blog.csdn.net/breaking1800/article/details/24563221

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案