我使用Spring Batch处理上传的文件。当我尝试读取具有30K记录的文件时,它只读取18k行并进行处理。它没有考虑剩下的记录。这些是在我的配置中声明的bean。
<job id="JobSeq1" restartable="true" parent="ParentJob">
<step id="DelegateTask" next = "FileParser" >
<tasklet ref = "JobTask">
<listeners>
<listener ref="PromotionListener" />
</listeners>
</tasklet>
</step>
<step id="FileParser" next = "FileStaggingProcessor" >
<tasklet ref = "FileParserTask">
<listeners>
<listener ref="PromotionListener" />
</listeners>
</tasklet>
</step>
<step id="FileStaggingProcessor">
<tasklet>
<chunk reader="FileReader" writer="FileWriter"
commit-interval="100" skip-limit="100">
<skippable-exception-classes>
<include class="org.springframework.batch.item.file.FlatFileParseException" />
</skippable-exception-classes>
</chunk>
</tasklet>
</step>
</job>
<beans:bean id="FileReader"
class="org.com.myProj.FileReader">
<beans:property name="linesToSkip" value="1"/>
<beans:property name="lineMapper">
<beans:bean
class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<beans:property name="lineTokenizer">
<beans:bean
class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<beans:property name="delimiter" value="," />
</beans:bean>
</beans:property>
<beans:property name="fieldSetMapper" ref="myMapper">
</beans:property>
</beans:bean>
</beans:property>
<beans:property name="saveState" value="true"></beans:property>
</beans:bean>
&#13;
读者看起来像
public class FileReader extends FlatFileItemReader<CombMappingVO> implements
StepExecutionListener{
@Override
public void beforeStep(StepExecution stepExecution) throws
StepListenerFailedException{
if(!inputFilePath.isEmpty() && !ObjectValidator.isObjectNull(inputFilePath))
{
String csvInputFilePath = new Helper().convert2CSV(inputFilePath);
super.setResource(new FileSystemResource(csvInputFilePath));
}
}
}
&#13;
我使用映射器将文件数据加载到临时表中,我可以看到确切的18K记录。有没有办法确定问题所在?