title: How to access execution context from a Spring Batch Step? Error: No context holder available for job scope
body: <p>I am trying to set the chunk size of my spring batch job at runtime by injecting it into my step as follows:</p>
  <pre><code>@Bean
  @JobScope
  @Qualifier(&quot;myStep&quot;)
  public Step myStep(@Value(&quot;#{jobExecutionContext['chunkSize']}&quot;) Integer chunkSize, StepBuilderFactory stepBuilderFactory, ItemReader&lt;Object&gt; reader, ItemWriter&lt;Object&gt; writer, Listener listener) {
      return stepBuilderFactory.get(&quot;myStep&quot;)
      .&lt;Object, Object&gt;chunk(chunkSize)
      .reader(reader)
      .writer(writer)
      .listener(listener)
      .build();
  }
  </code></pre>
  <p>But I am getting the following error: <strong>java.lang.IllegalStateException: No context holder available for job scope</strong></p>
  <p>I've done some research online but am not able to understand why I am hitting this exception. I'd appreciate assistance in understanding what this error means and how to resolve it. Thanks!</p>