No, it's not possible.
I think it's good and simple to have primitive parameters. Because then you can mediate risk of having parameter object versioning issues, which leads then to deserialization issues. Imagine you have your object as a parameter and then you update it in next version. Then your current application will be no longer able to restart old failing job.
Also please note third boolean flag for parameters 'identifying'.
From documentation: The identifying flag is used to indicate if the parameter is to be used as part of the identification of a job instance.
@Controller
public class JobLauncherController {
@Autowired
JobLauncher jobLauncher;
@Autowired
Job job;
@RequestMapping("/jobLauncher.html")
public void handle() throws Exception{
JobParameters jobParameters = new JobParametersBuilder()
.addString("MyParameter", "value", true)
.toJobParameters();
jobLauncher.run(job, jobParameters);
}
}
More you can find in documentation: https://docs.spring.io/spring-batch/4.0.x/reference/html/job.html