title: Spring Batch: execute same job with different parameters
body: <p>I'm newbie in sprint batch, and I couldn't find an answer for my problem.</p>
  
  <p>I'm trying to implement a JOB using spring boot and spring batch. My JOB needs a parameter, so I'm executing the application like this:</p>
  
  <blockquote>
    <p>java -jar -Dspring.profiles.active=gus
    /applications/botbit-batch/botbit-batch-1.0.0.jar
    --spring.batch.job.names=persistCustomerSuccessMetrics <strong>date=2015-12-13</strong></p>
  </blockquote>
  
  <p>In bold, is the parameter I need.</p>
  
  <p>I executed the application a first time, but in later executions my job allways use the parameter I passed in the first execution.</p>
  
  <p>The logs shows:</p>
  
  <pre><code>Running default command line with: 
  [spring.batch.job.names=persistCustomerSuccessMetrics, date=2015-12-13]
  </code></pre>
  
  <p>and a few lines after:</p>
  
  <pre><code>Job: [FlowJob: [name=persistCustomerSuccessMetrics]] launched with the following parameters: 
  [{date=2015-12-12, -spring.batch.job.names=persistCustomerSuccessMetrics, run.id=2}]
  </code></pre>
  
  <p>The date 2015-12-12 is the date from first execution, and I'm not able to execute the job again with a different parameter.</p>
  
  <p>My job setup:</p>
  
  <pre><code>@Bean
  @JobScope
  public CustomerSuccessMetricsReader customerSuccessMetricsReader(@Value("#{jobParameters[date]}") String date) {
      return new CustomerSuccessMetricsReader(storeStatisticsUrl, restTemplate, date);
  }
  @Bean
  public CustomerSuccessMetricsProcessor customerSuccessMetricsProcessor() {
      return new CustomerSuccessMetricsProcessor();
  }
  @Bean
  public Job persistCustomerSuccessMetrics(Step persistCustomerSuccessMetricsStep1) {
      return jobBuilderFactory.get("persistCustomerSuccessMetrics").incrementer(new RunIdIncrementer())
              .listener(new CustomerSuccessMetricsCompletionListener()).flow(persistCustomerSuccessMetricsStep1).end().build();
  }
  @Bean
  public Step persistCustomerSuccessMetricsStep1() {
      return stepBuilderFactory.
              get("persistCustomerSuccessMetricsStep1").
              &lt;CustomerSuccessMetricsDTO, CustomerSuccessMetricsDTO&gt; chunk(10).
              reader(customerSuccessMetricsReader(null)).
              processor(customerSuccessMetricsProcessor()).
              //writer(customerSuccessMetricsWriter).
              build();
  }
  </code></pre>
  
  <blockquote>
    <p>I've tried to remove the <strong>incrementer(new RunIdIncrementer())</strong>
    In that case it works fine, but I'm not able to repeat de execution with the same parameters.</p>
  </blockquote>
  
  <p>So, i need to implement this job with the following rqs:</p>
  
  <ul>
  <li>The job must take execution parameter, and not the parameter stored in database</li>
  <li>The job must support multiple executions with the same parameter. </li>
  </ul>
  
  <p>I'll appreciate any help.
  Regards</p>