![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
BeanUtils
Cx春耕秋收
这个作者很懒,什么都没留下…
展开
-
BeanUtils.copyProperties(A,B)
BeanUtils有2个包 ,关于BeanUtils.copyProperties(a, b)方法的使用也不一样,分别是:1.package org.apache.commons.beanutils;BeanUtils.copyProperties(A,B);是B中的值赋给A2.package org.springframework.beans;BeanUtils.copyProperties(A,B);是A中的值赋给B...原创 2022-05-24 18:24:46 · 146 阅读 · 0 评论 -
ConvertUtils.register注册转换器
当用到BeanUtils的populate、copyProperties方法或者getProperty,setProperty方法其实都会调用convert进行转换Converter只支持一些基本的类型,甚至连java.util.Date类型也不支持。而且当遇到不认识的类型时,会抛出异常(例如org.apache.commons.beanutils.ConversionException)。这个时候就需要给类型注册转换器,比如特别是在web项目中,如果没有注册日期的话,formbean中将不支持java原创 2022-05-24 18:10:01 · 772 阅读 · 0 评论