通过",;资源“;从spring批处理中的上一个步骤到multiResourceReader的属性值

通过",;资源“;从spring批处理中的上一个步骤到multiResourceReader的属性值,spring,resources,spring-batch,Spring,Resources,Spring Batch,我需要从文件夹中读取csv文件,并将其写入数据库,还需要存档这些文件。下面是用xml描述的作业 <job id="importJob" xmlns="http://www.springframework.org/schema/batch"> <step id="validateFileStep" > <tasklet ref="validateFileTasklet" />

我需要从文件夹中读取csv文件,并将其写入数据库,还需要存档这些文件。下面是用xml描述的作业

<job id="importJob" xmlns="http://www.springframework.org/schema/batch">
          <step id="validateFileStep" >
            <tasklet ref="validateFileTasklet" />            
              <next on="*" to="importFileStep" />
              <next on="FAILED" to="archiveFileStep" />               
        </step>  
    <step id="importFileStep"  next="archiveFileStep">          
            <tasklet>
                <chunk reader="multiResourceReader" writer="csvWriter"
                    commit-interval="1" >                   
                </chunk>
            </tasklet>
        </step>
        <step id="archiveFileStep">
            <tasklet ref="archiveFileTasklet" />
        </step>             
    </job>

MultiResourceReaderbean定义

<bean id="multiResourceReader"  class="org.springframework.batch.item.file.MultiResourceItemReader" scope="step">
    <property name="resources" value="classpath:data/*.csv" />
    <property name="delegate" ref="csvReader" />
  </bean>

代码运行良好,但我需要从“validateFileStep”步骤获取它,而不是在xml中提供“resources”属性值,因为读者应该只读取格式正确的csv文件。我还应该将其传递给archiveFileStep,以便在归档文件中相应地将文件名附加为completed或failed

下面是阅读器bean def

    <!-- property to skip the headers, as no headers in CSV, value is 0 -->
    <property name="linesToSkip" value="0" />       
    <property name="lineMapper">
        <bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">

            <property name="lineTokenizer">
                <bean
                    class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
                    <property name="delimiter" value="," />
                    <!-- Names of the CSV columns -->
                    <property name="names"
                        value="id,name,city" />
                </bean>
            </property>

            <property name="fieldSetMapper">
                <bean
                    class="com.common.service.csvFieldSetMapper" />
            </property>
        </bean>
    </property>
</bean>