0

I am using Spring Batch version 2.1.8. The job context shown as below:

<job id="job1" restartable="true"  >
    <step id="step1">
        <tasklet>
            <chunk reader="reader" writer="writter" processor="processor"
                commit-interval="1" />
        </tasklet>
    </step>
    <validator ref="jobParameterValidator"></validator> 
</job>

The jobParamterValidator is to get the file name and do some validation on filename.

So my question is how can I get the fileName at processor="processor", because want to validate filename with data? Thanks.

user1238353
  • 179
  • 2
  • 15

1 Answers1

3

use #{jobParameters['fileName']}, but you need to mark your step with scope="step" else placeholder doesn't work.
You can read more at What are the Spring Batch "default" Context Variables?

Community
  • 1
  • 1
Luca Basso Ricci
  • 17,829
  • 2
  • 47
  • 69