BeanUtil.copyproperties()的基本使用

BeanUtil.copyproperties() 源中值会覆盖target中的值

//1.spring中的使用,不需要引入依赖

BeanUtil.copyproperties(source,target);

//2.apach

2.1依赖

 <!-- apache中BeanUtils的依赖 org.apache.commons.beanutils.BeanUtils.copyProperties -->

        <dependency>

            <groupId>commons-beanutils</groupId>

            <artifactId>commons-beanutils</artifactId>

            <version>1.9.4</version>

        </dependency>

   <!-- 创建springboot项目 org.springframework.beans.BeanUtils -->

 

2.2BeanUtil.copyproperties(target,source);

 

注意:拷贝属性值成功的前提,属性命类型都相同

相关推荐

  1. postgresql基本使用

    2024-04-30 10:38:04       53 阅读
  2. Redisson基本使用

    2024-04-30 10:38:04       55 阅读
  3. 【Docker 基本使用

    2024-04-30 10:38:04       52 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-30 10:38:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-30 10:38:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-30 10:38:04       87 阅读
  4. Python语言-面向对象

    2024-04-30 10:38:04       96 阅读

热门阅读

  1. 【无标题】

    2024-04-30 10:38:04       27 阅读
  2. CSS 控制溢出行为

    2024-04-30 10:38:04       26 阅读
  3. 远程修改注册表的reg命令

    2024-04-30 10:38:04       32 阅读
  4. Python正则表达式

    2024-04-30 10:38:04       33 阅读
  5. c++day6

    c++day6

    2024-04-30 10:38:04      32 阅读
  6. spring-ioc

    2024-04-30 10:38:04       32 阅读
  7. 【蓝桥杯2024真题】好数

    2024-04-30 10:38:04       35 阅读
  8. 算法的时间复杂度和空间复杂度

    2024-04-30 10:38:04       32 阅读
  9. 无人机证书的含金量

    2024-04-30 10:38:04       28 阅读