Spring Batch - Read once and write twice

后端 未结 1 1902
迷失自我
迷失自我 2021-01-25 04:21

I am new to Spring Batch. My requirement is I have a reader which gets the records through a web service call/database call and currently I am writing those records to one table

1条回答
  •  孤街浪徒
    2021-01-25 05:05

    Spring Batch defines independent steps for processing. Each step is responsible for their input, processing, and output. Because of this, I'd structure the job something like:

    
        
            
                
            
        
        
            
                
            
        
    
    

    With the above configuration, the reader would be a step scoped reader that reads in type A. The typeAwriter writes out type A. The processor is the processor that converts type A to type B. The typeBwriter writes type B. Since the processor returns a list of type B, the typeBwriter would need to be a custom implementation that loops over the lists that the processor returns (typeBwriter would take a List>).

    0 讨论(0)
提交回复
热议问题