BeanUtils.copyProperties imports different packages, and the assignment order is different

I have used the method BeanUtils.copyProperties() in the project in the past two days, and I have used this method in two different classes, but somehow, there is an object service that sends copy of another object, and finally found the reason. .

Because the two classes introduce two different BeanUtils classes,

one for org.springframework.beans.BeanUtils,

The other is org.apache.commons.beanutils.BeanUtils,

These two classes are under different packages, and the parameter assignments passed in the copyProperties() methods of these two classes are opposite.

For example:
a, b are objects
BeanUtils.copyProperties(a, b);
BeanUtils is org.springframework.beans.BeanUtils, a is copied to b
BeanUtils is org.apache.commons.beanutils.BeanUtils, b is copied to a

Reprinted from: http://blog.csdn.net/breaking1800/article/details/24563221

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325674315&siteId=291194637