使用easypoi时遇到cn.afterturn.easypoi.exception.excel.ExcelImportException: 创建对象异常错误

版权声明:原创,转载需告知 https://blog.csdn.net/qq_42136250/article/details/88983441

使用easyPOI进行导入数据时的错误

在这里插入图片描述

domain结构:
在这里插入图片描述在这里插入图片描述表结构:
在这里插入图片描述测试代码:

@Test
   public void test() throws Exception {
       ImportParams params = new ImportParams();
      params.setTitleRows(1);
       params.setHeadRows(1);
       List<Student> list = ExcelImportUtil.importExcel(
               new File("src/test/java/cn/pj/aisell/easypoi","stu-poi.xls"),
               Student.class, params);

       list.forEach(employee -> {
           System.out.println(employee);
       });
   }

==错误原因:==提示说创建对象异常,是因为没有给student提供无参构造,所以一直报错

猜你喜欢

转载自blog.csdn.net/qq_42136250/article/details/88983441