写一段BeanUtils.copyProperties示例
时间: 2023-03-03 13:39:09 浏览: 168
org.apache.commons.beanutils.BeanUtils实例
3星 · 编辑精心推荐
例子:
TestBean srcBean = new TestBean();
srcBean.setProperty1("value1");
srcBean.setProperty2("value2");
TestBean destBean = new TestBean();
BeanUtils.copyProperties(srcBean, destBean);
System.out.println("destBean.getProperty1() = " + destBean.getProperty1());
System.out.println("destBean.getProperty2() = " + destBean.getProperty2());示例:TestBean srcBean = new TestBean(); srcBean.setProperty1("value1"); srcBean.setProperty2("value2"); TestBean destBean = new TestBean(); BeanUtils.copyProperties(srcBean, destBean); System.out.println("destBean.getProperty1() = " + destBean.getProperty1()); System.out.println("destBean.getProperty2() = " + destBean.getProperty2());
阅读全文