diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java index a0ce64156261..3913b010e770 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -180,8 +180,7 @@ private JobParameters merge(JobParameters parameters, Map merged = new HashMap<>(); merged.putAll(parameters.getParameters()); merged.putAll(additionals); - parameters = new JobParameters(merged); - return parameters; + return new JobParameters(merged); } private void executeRegisteredJobs(JobParameters jobParameters) @@ -198,7 +197,6 @@ private void executeRegisteredJobs(JobParameters jobParameters) } catch (NoSuchJobException ex) { logger.debug("No job found in registry for job name: " + jobName); - continue; } } } @@ -209,11 +207,9 @@ protected void execute(Job job, JobParameters jobParameters) JobInstanceAlreadyCompleteException, JobParametersInvalidException, JobParametersNotFoundException { JobParameters nextParameters = getNextJobParameters(job, jobParameters); - if (nextParameters != null) { - JobExecution execution = this.jobLauncher.run(job, nextParameters); - if (this.publisher != null) { - this.publisher.publishEvent(new JobExecutionEvent(execution)); - } + JobExecution execution = this.jobLauncher.run(job, nextParameters); + if (this.publisher != null) { + this.publisher.publishEvent(new JobExecutionEvent(execution)); } }