Spring Batch:如何实现一对多的ItemProcessor

huangapple go评论69阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年4月9日 06:20:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/61110970.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定