我不确定flatfileitemreader是否有能力在遇到异常时存储最后一行。因此,当我重新运行批处理应用程序时,它将能够从最后一行继续。
任何实现以下使用原因的示例都会有帮助,谢谢!
public static FlatFileItemReader<Employee> reader(String path){
FlatFileItemReader<Employee> reader = new FlatFileItemReader<Employee>();
reader.setResource(new ClassPathResource(path));
reader.setLineMapper(new DefaultLineMapper<Employee>() {
{
setLineTokenizer(new DelimitedLineTokenizer() {
{
setNames(new String[] {"firstName", "lastName", "emailId"});
}
});
setFieldSetMapper(new BeanWrapperFieldSetMapper<Employee>() {
{
setTargetType(Employee.class);
}
});
}
});
return reader;
}}
1条答案
按热度按时间hec6srdp1#
我认为这是
FlatFileItemReader
```DefaultLineMapper
Now that the basic interfaces for reading in flat files have been defined, it becomes clear that three basic steps are required:
Read one line from the file.