org.springframework.beans.BeanUtils usage

s, t for the object
BeanUtils.copyProperties (s, t); copy given to the source bean property values of the target bean

public static void copyProperties(Object source, Object target) //source 源,target 目标
throws BeansException {
   copyProperties(source, target, null, (String[]) null);
}

 

Bean given copy source attribute value to the target bean, Id and Time attribute is ignored; BeanUtils.copyProperties (s, t, "Id", "Time")

public  static  void copyProperties (Source Object, Object target, String ... ignoreProperties) // Source source, target goal, ignoreProperties array of property names to be ignored 
  throws BeansException { 
        copyProperties (Source, target, null , ignoreProperties); 
    }

 

Guess you like

Origin www.cnblogs.com/andrew-303/p/11589892.html