title: Spring batch jobParameters value null
body: <p>In a spring batch, I'm trying to pass <code>jobParameters</code> and use them in my <code>JdbcCursorItemReader</code>. A snippet from the same is:</p>
  <pre><code>@Configuration
  public class SpringBatchConfig extends DefaultBatchConfigurer{
  
      private String demoVar;
  
      public String getDemoVar() {
          return demoVar;
      }
  
      public void setDemoVar(@Value(&quot;#{jobParameters['demoVarValue']}&quot;) String demoVar) {
          this.demoVar = demoVar;
      }
  
      @Bean
      @StepScope
      public JdbcCursorItemReader&lt;User&gt; reader1() {
          String sqlQuery = String.format(&quot;select * FROM TABLE_NAME where demoVar=? &quot;);
          System.out.println(demoVar);
          JdbcCursorItemReader&lt;User&gt; cursorItemReader = new JdbcCursorItemReader&lt;&gt;();
          cursorItemReader.setDataSource(dataSource);
          cursorItemReader.setSql(sqlQuery);
          cursorItemReader.setPreparedStatementSetter(new PreparedStatementSetter() {
             public void setValues(PreparedStatement preparedStatement) throws SQLException {
                preparedStatement.setString(1, demoVar);
             }
          });
          cursorItemReader.setRowMapper(new DbRowMapper());
          return cursorItemReader;
      }
  ...
  </code></pre>
  <p>Controller class(containing job launcher):</p>
  <pre><code>@RestController
  @RequestMapping(&quot;/load&quot;)
  public class LoadController {
  
      @Autowired
      JobLauncher jobLauncher;
  
      @Autowired
      Job job;
  
      @GetMapping(&quot;/users&quot;)
      public BatchStatus load() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {
          
          JobParameters jobParameters = new JobParametersBuilder()
                                      .addString(&quot;demoVarValue&quot;, &quot;001&quot;)
                                      .toJobParameters();
          
          JobExecution jobExecution = jobLauncher.run(job, jobParameters);
  
          System.out.println(&quot;JobExecution: &quot; + jobExecution.getStatus());
  
          return jobExecution.getStatus();
      }
  }
  </code></pre>
  <p>But in the <code>reader</code> bean, the value of the <code>demoVar</code> parsed from <code>jobParameters</code> is being passed as <code>null</code> instead of the expected <code>001</code>.</p>