我正在使用带有Spring批处理3.0.7的Spring 4.3.3并获得此异常:
Caused by: org.springframework.beans.TypeMismatchException: Failed to
convert property value of type [java.util.LinkedHashMap] to required
type [java.util.Map] for property 'customEditors'; nested exception
is java.lang.IllegalArgumentException: Cannot convert value of type
[org.springframework.batch.item.file.transform.RangeArrayPropertyEditor]
to required type [java.lang.Class] for property 'customEditors[org.springframework.batch.item.file.transform.Range[]]':
PropertyEditor [org.springframework.beans.propertyeditors.ClassEditor]
returned inappropriate value of type
[org.springframework.batch.item.file.transform.RangeArrayPropertyEditor]
代码:
<bean id="customEditorConfigurer"
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="org.springframework.batch.item.file.transform.Range[]">
<bean
class="org.springframework.batch.item.file.transform.RangeArrayPropertyEditor" />
</entry>
</map>
</property>
</bean>
答案 0 :(得分:0)
试试这个:
<bean id="customEditorConfigurer"
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="org.springframework.batch.item.file.transform.Range[]" value="org.springframework.batch.item.file.transform.RangeArrayPropertyEditor"/>
</map>
</property>