org.springframework.beans.ConversionNotSupportedException: for type string to the required type Range[]

org.springframework.beans.ConversionNotSupportedException: for type string to the required type Range[]

我正在使用 spring 批处理从平面文件中读取数据

<bean id="dataTokenizer"
    class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
    <property name="names"
        value="linkageId,recordValue,description,facilityName,invoiceId,purchaseOrderId" />
    <property name="columns"
        value="2-5,6-25,26-185,186-255,256-271,272-287" />
</bean>

我遇到以下异常:

org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:springconfig/springconfig-apc.xml], factory key [ear.context]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ear.context' defined in URL [file:/C:/ccer/Project1/PNX/appEAR/properties/springconfig/springconfig-apc.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataTokenizer' defined in class path resource [springconfig/springconfig-apc-domainmapper.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.batch.item.file.transform.Range[]' for property 'columns'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.batch.item.file.transform.Range] for property 'columns[0]': no matching editors or conversion strategy found

如果需要任何其他信息,请告诉我。

尝试添加以下 bean 定义。

来源 - http://docs.spring.io/spring-batch/1.1.x/spring-batch-docs/reference/html/spring-batch-infrastructure.html

 <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>