title: using stepExecution in Spring Batch
body: <p>I am trying to use stepExecution to retain data in a Spring batch. However I am running into some issues when I attempt to use it in my code execution:</p>
  
  <pre><code>ExecutionContext stepContext = this.stepExecution.getExecutionContext();
  </code></pre>
  
  <p>stepExecution was not recognized when I tired this. I imported org.springframework.batch.core.StepExecution and also tried: </p>
  
  <pre><code>ExecutionContext context = StepExecution.getJobExecution().getExecutionContext();
  </code></pre>
  
  <p>Here StepExecution was recognized but I get a "Cannot make static reference to non-static method" error. Is my project not set up right; what am I doing wrong here?</p>
  
  <pre><code>import TextFileReader;
  import OracleService;
  import java.util.Date;
  import java.util.List;
  
  import org.apache.commons.lang.StringUtils;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.batch.core.StepContribution;
  import org.springframework.batch.core.scope.context.ChunkContext;
  import org.springframework.batch.core.step.tasklet.Tasklet;
  import org.springframework.batch.item.ExecutionContext;
  import org.springframework.batch.repeat.RepeatStatus;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.batch.core.StepExecution;
  
  
  public class myTask implements Tasklet {
  
  private List&lt;String&gt; sourceQueries;
  private List&lt;String&gt; targetQueries;
  
  @Override
  public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  
      ExecutionContext context = StepExecution.getJobExecution().getExecutionContext();
  
      ExecutionContext stepContext = this.stepExecution.getExecutionContext();
      stepContext.put("theListKey", sourceQueries);
  
      return RepeatStatus.FINISHED;
  }
  
  public List&lt;String&gt; getSourceQueries() {
      return sourceQueries;
  }
  
  public void setSourceQueries(List&lt;String&gt; sourceQueries) {
      this.sourceQueries = sourceQueries;
  }
  
  public List&lt;String&gt; getTargetQueries() {
      return targetQueries;
  }
  
  public void setTargetQueries(List&lt;String&gt; targetQueries) {
      this.targetQueries = targetQueries;
  }
  </code></pre>
  
  <p>}</p>