diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java b/easyexcel-core/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java index 057919e9..44f77513 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java @@ -15,8 +15,8 @@ import com.alibaba.excel.util.ClassUtils; import com.alibaba.excel.util.ConverterUtils; import com.alibaba.excel.util.MapUtils; -import net.sf.cglib.beans.BeanMap; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.cglib.beans.BeanMap; /** * Convert to the object the user needs diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java b/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java index b089612b..30b2c692 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java @@ -23,9 +23,9 @@ public class BeanMapUtils { */ public static BeanMap create(Object bean) { BeanMap.Generator gen = new BeanMap.Generator(); - //gen.setBean(student); - //gen.setContextClass(Student.class); - BeanMap beanMap = gen.create(); + gen.setBean(bean); + gen.setContextClass(bean.getClass()); + gen.setNamingPolicy(EasyExcelNamingPolicy.INSTANCE); return gen.create(); } diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java b/easyexcel-core/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java index 0bb4007c..459f0a7a 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java @@ -25,10 +25,10 @@ import com.alibaba.excel.write.metadata.RowData; import com.alibaba.excel.write.metadata.holder.WriteHolder; import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; -import net.sf.cglib.beans.BeanMap; import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; +import org.springframework.cglib.beans.BeanMap; /** * Add the data into excel diff --git a/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Xls03Test.java b/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Xls03Test.java index 906c092e..ffb590ee 100644 --- a/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Xls03Test.java +++ b/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Xls03Test.java @@ -6,12 +6,12 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.util.BeanMapUtils; import com.alibaba.fastjson.JSON; -import net.sf.cglib.beans.BeanMap; -import net.sf.cglib.core.DebuggingClassWriter; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.cglib.beans.BeanMap; +import org.springframework.cglib.core.DebuggingClassWriter; /** * 临时测试 diff --git a/pom.xml b/pom.xml index b6d002d0..cf150db3 100644 --- a/pom.xml +++ b/pom.xml @@ -385,6 +385,37 @@ + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + false + + + org.springframework:spring-core + + org/springframework/asm/** + org/springframework/cglib/** + + + + + + org.springframework + com.alibaba.easyexcel.support + + + + + +