英文:
Spring Batch: How to implement a many-to-one ItemProcessor
问题
我有一个非常大的电子表格集,需要使用Spring Batch生成。
我有一个发出“行”的ItemReader,并且我希望我的ItemProcessor为每接收3000行,发出1个“工作表”。
有没有办法在Spring中指定这种一对多的处理关系?
英文:
I have a very large set of spreadsheets that need to be generated using spring batch.
I have an ItemReader emitting "Rows", and I would like my ItemProcessor to emit 1 "Sheet" for every 3000 Rows it receives.
Is there any way to specify this many-to-one processing relationship to spring?
答案1
得分: 1
你不需要一个“多对一的ItemProcessor”。你可以使用一个分块步骤,块大小设置为3000(这应该没问题),并使用一个每块写入一个表的项写入器。
英文:
It is not a "many-to-one ItemProcessor" that you need. You can use a chunk oriented step with a chunk size of 3000 (this should be ok) with an item writer that writes a sheet per chunk.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论