BeanUtils copyProperties API to ignore null and specific propertie
If you want to ignore null
-value you have to do it with the following line of code before copying properties:
BeanUtilsBean.getInstance().getConvertUtils().register(false, false, 0);
In case you are using the org.springframework.beans.BeanUtils
you can ignore specific properies using the method copyProperties(Object source, Object target, String... ignoreProperties)
. An example,
BeanUtils.copyProperties(sourceObj, targetObj, "aProperty", "another");