How to process logically related rows after ItemReader in SpringBatch?

前端 未结 5 2138
忘掉有多难
忘掉有多难 2020-12-15 05:51

Scenario

To make it simple, let\'s suppose I have an ItemReader that returns me 25 rows.

  1. The first 10 rows belong to student A

  2. The

5条回答
  •  时光说笑
    2020-12-15 06:17

    I always follow this pattern:

    1. I make my reader scope to be "step", and in @PostConstruct I fetch the results, and put them in a Map
    2. In processor, I convert the associatedCollection into writable list, and send the writable list
    3. In ItemWriter, I persist the writable item(s) depending on the case

提交回复
热议问题