From 85d8a2fa80495cac05989d5ac8e9a25378ee8ead Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 9 Mar 2026 16:30:20 +0800 Subject: [PATCH] update deprecated --- .../src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 7fb2c65a1a..b65f049024 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -423,7 +423,7 @@ public class ExcelUtil Object val = this.getCellValue(row, entry.getKey()); // 如果不存在实例则新建. - entity = (entity == null ? clazz.newInstance() : entity); + entity = (entity == null ? clazz.getDeclaredConstructor().newInstance() : entity); // 从map中得到对应列的field. Field field = (Field) entry.getValue()[0]; Excel attr = (Excel) entry.getValue()[1]; @@ -1438,7 +1438,7 @@ public class ExcelUtil { try { - Object instance = excel.handler().newInstance(); + Object instance = excel.handler().getDeclaredConstructor().newInstance(); Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class }); value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb); }