For now, I\'m using jobParameters to get the filenames for both my FlatFileItemReader and FlatFileItemWriter. It\'s okay for testing my batch, but my goal is to read a file in s
In tasklet you have ChunkContext
at your disposal so you do not need @BeforeStep
, you can remove it (in my configuration it is not invoked at all, and when you think of it as one action step does not make much sense but I do not see NPE so guess that part work). We solved it with one of two approaches:
You can put any parameter from tasklet to job ExecutionContext
directly using chunkContext.getStepContext().getStepExecution().getJobExecution().getExecutionContext().put("inputFile", inputFilename);
You can add ExecutionContextPromotionListener
to your tasklet step and then do chunkContext.getStepContext().getStepExecution().getExecutionContext().put("inputFile", inputFilename);