org.springframework.beans.BeanUtils
{//拷贝对象的属性 Hello user1 = new Hello(); user1.setId(1); user1.setName("name"); Hello user2 = new Hello(); BeanUtils.copyProperties(user1, user2); System.out.println(user2); } {//实例化某个类 Hello user = BeanUtils.instantiateClass(Hello.class);//通过反射实例化一个类的对象 System.out.println(user); } {//获取指定类的指定方法 Method declaredMethod = BeanUtils.findDeclaredMethod(Hello.class, "getId"); System.out.println(declaredMethod.getName()); } {//获取指定方法的参数 Method declaredMethod = BeanUtils.findDeclaredMethod(Hello.class, "getId"); PropertyDescriptor propertyForMethod = BeanUtils.findPropertyForMethod(declaredMethod); System.out.println(propertyForMethod.getName()); }