Can we use single flatFileItemReader bean in multiple steps running in parallel in spring batch?

StackOverflow https://stackoverflow.com/questions/23337686

  •  10-07-2023
  •  | 
  •  

質問

I have a single file with list of exchanges. I am doing different processing on the exchanges in different steps which runs in parallel.

Can I use same instance of flatFileItemReader or I should create separate bean for each step ?

役に立ちましたか?

解決

From javadoc

A FlatFileItemReader is not thread safe because it maintains state in the form of a ResourceLineReader. Be careful to configure a FlatFileItemReader using an appropriate factory or scope so that it is not shared between threads.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top