@GetMapping("/stopjob")
public void stop() throws Exception{
Set<Long> executions = jobOperator.getRunningExecutions("LoadData");
jobOperator.stop(executions.iterator().next());
}
@GetMapping("/resumejob/{id}")
public void restart(@PathVariable(name = "id") long id) throws Exception {
jobRegistry.register(new ReferenceJobFactory(job));
jobOperator.restart(id); // (1)
}
stop a job works fine but resume job works just the first time after running the project and if i invoke this method another time i get this execption
org.springframework.batch.core.configuration.DuplicateJobException: A job configuration with this name [LoadData] was already registered
any solution !