BeanUtils工具的使用
生活随笔
收集整理的這篇文章主要介紹了
BeanUtils工具的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
BeanUtils
屬性拷貝
BeanUtils.copyProperties(a, b);
注意
在不同的包下面,拷貝順序相反
org.springframework.beans.BeanUtils
表示,a拷貝到b
org.apache.commons.beanutils.BeanUtils
表示,b拷貝到a
使用方式
導入對應的包,直接使用
import org.springframework.beans.BeanUtils;
BeanUtils.copyProperties(sample, sampleExt);
或者
import org.apache.commons.beanutils.BeanUtils;
BeanUtils.copyProperties(sample, sampleExt);
總結
以上是生活随笔為你收集整理的BeanUtils工具的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java数组操作
- 下一篇: BeanUtils的方法