Skip to content

6.0.0-M3 migration help #5005

@mjd507

Description

@mjd507

hi, I am upgrading spring-boot to 4.0.0-M3, which includes spring-batch 6.0.0-M3.
however, I blocked with a small issue and not sure how to solve that.

all my Job contains a incrementer().

@Bean(name = "CsvJob")
public Job csvFileImportJob(JobRepository jobRepository) {
  return new JobBuilder("CsvFileJobBuilder", jobRepository)
      .preventRestart()
      .incrementer(new RunIdIncrementer())
      .start(csvFileImportStep(jobRepository))
      .listener(csvFileListener)
      .build();
}

I have additional parameters when running the job.

JobParameters jobParameters = new JobParametersBuilder()
    .addString("csvFilePath", "src/test/resources/batch-data.csv")
    .toJobParameters();

before migration, we use JobLauncher to run the job, no issues.

jobLauncher.run(csvFileImportJob, jobParameters);

when migrating to 6.0.0-M3. if I still use jobLauncher, no issues, job runs successfully.

however, JobLauncher is marked as deprecated for removal in favor of JobOperator,
but if use jobOperator, the job will fail because the additional jobParameters are ignored.

jobOperator.start(csvFileImportJob, jobParameters);

kindly suggest.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions