cn.hutool.core.bean.BeanUtil
- beanToMap,实现类似 @RequestBody的功能
Cart cart=new Cart();
cart.setCartId(1l);
cart.setDealerName("huangzhenshi");
cart.setShopId("shop2");
Map map=BeanUtil.beanToMap(cart);
System.out.println("map = " + map);
- copyProperties最实用的方法,比如远程获取几个属性,然后返回给VO,用这个方法避免了一个个同名参数的复制
public static void copyProperties(Object source, Object target) {
copyProperties(source, target, CopyOptions.create());
}