java.lang.IllegalArgumentException: Source must not be null

    ProductManagementAppEntity entity = Mapper.selectOne(
            new QueryWrapper<Entity>().eq("id", id));
    Resp resp=new Resp();
    if (entity != null){
        BeanUtil.copyProperties(entity,resp);
    }
    return ResponseUtil.ok(resp);

我的这个错误原因在于查询数据库没有查到数据,返回值为空,使用工具转换时异常了。如果是自己封装的类转换工具类的话,记得把判空加上。
 

猜你喜欢

转载自blog.csdn.net/wufaqidong1/article/details/130134903