简体   繁体   English

Spring批处理组验证来自FlatFileItemReader的输入行

[英]spring batch group validate input lines from FlatFileItemReader

I have a spring batch job where in I use FlatFileItemReader and populate it to Pojo objects (items). 我有一个春季批处理作业,在其中我使用FlatFileItemReader并将其填充到Pojo对象(项目)中。 My file has a footer line that gives me the number of records in the file. 我的文件的页脚行显示了文件中的记录数。 I need to validate that my List has that many objects. 我需要验证我的列表中有这么多对象。

I cannot do it through ItemProcessor as it gives me only one item at a time. 我无法通过ItemProcessor做到这一点,因为它一次只能给我一个项目。 Is there any other way to do such a validation in spring batch? 在春季批处理中还有其他方法可以进行这种验证吗?

Thanks Paddy 谢谢帕迪

Spring's FlatFileItemReader provides a feature to skip the number of line at the top and end. Spring的FlatFileItemReader提供了一项功能,可跳过顶部和底部的行数。 This issue got solved using them. 使用它们解决了这个问题。 Don't have a postable code, but was led to the answer from the the reader writer documentation. 没有可发布的代码,但是从读者文档中得到了答案。

https://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html https://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM