BeanUtils.copyProperties三个参数
时间: 2023-10-15 18:22:37 浏览: 139
Bean.copyProperties方法可以通过添加第三个参数来指定要忽略的属性。这个参数可以是一个属性名的字符串,表示要忽略的单个属性,也可以是一个属性名的字符串数组,表示要忽略的多个属性。例如,可以使用以下代码复制属性并忽略id属性:BeanUtils.copyProperties(source, target, "id")。如果要忽略多个属性,可以使用以下代码:BeanUtils.copyProperties(source, target, new String[]{"id", "createDate", "modifyDate"})。这样,在复制属性时就会忽略这些属性。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Beanutils.copyProperties( )用法与注意事项归整](https://blog.csdn.net/nsqd001A/article/details/100043207)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [BeanMapper:比BeanUtils.copyProperties更快](https://download.csdn.net/download/weixin_42131785/15331636)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文