May 2015
Intermediate to advanced
234 pages
4h 18m
English
In this recipe, you'll learn how to retrieve and use a job parameter value in Tasklet.
We'll use the job defined in the Creating a job recipe.
Follow these steps to use the job parameters:
Task1 class, add @StepScope to the execute() method:@StepScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
throws Exception {
...execute() method, retrieve a job parameter value by using the job parameter name:String test = (String)chunkContext.getStepContext().getJobParameters(). get("test")test:mvn compile exec:java - Dexec.mainClass=org.springframework.batch.core.launch. support.CommandLineJobRunner - Dexec.args="com.spring_cookbook.batch.BatchConfig ...
Read now
Unlock full access