diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java b/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java index d2ac7135..f9a53e08 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java @@ -564,11 +564,13 @@ public class ClassUtils { FieldCacheKey(Class clazz, ConfigurationHolder configurationHolder) { this.clazz = clazz; - WriteHolder writeHolder = (WriteHolder)configurationHolder; - this.excludeColumnFieldNames = writeHolder.excludeColumnFieldNames(); - this.excludeColumnIndexes = writeHolder.excludeColumnIndexes(); - this.includeColumnFieldNames = writeHolder.includeColumnFieldNames(); - this.includeColumnIndexes = writeHolder.includeColumnIndexes(); + if (configurationHolder instanceof WriteHolder) { + WriteHolder writeHolder = (WriteHolder)configurationHolder; + this.excludeColumnFieldNames = writeHolder.excludeColumnFieldNames(); + this.excludeColumnIndexes = writeHolder.excludeColumnIndexes(); + this.includeColumnFieldNames = writeHolder.includeColumnFieldNames(); + this.includeColumnIndexes = writeHolder.includeColumnIndexes(); + } } }