Deprecating the CommandLineRunnerOrder renaming it to ApplicaitonRunnerOrder

This is to reflect the foundation class of CommandLineRunner which is ApplicationRunner
This commit is contained in:
Glenn Renfro
2022-11-15 20:10:15 -05:00
parent 545748b91a
commit 501d75681b
4 changed files with 20 additions and 10 deletions

View File

@@ -38,12 +38,12 @@ public class TaskBatchProperties {
private String jobNames = "";
/**
* The order for the {@code CommandLineRunner} used to run batch jobs when
* The order for the {@code ApplicationRunner} used to run batch jobs when
* {@code spring.cloud.task.batch.fail-on-job-failure=true}. Defaults to 0 (same as
* the
* {@link org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner}).
* {@link org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner}).
*/
private int commandLineRunnerOrder = 0;
private int applicationRunnerOrder = 0;
/**
* Fixed delay in milliseconds that Spring Cloud Task will wait when checking if
@@ -60,12 +60,22 @@ public class TaskBatchProperties {
this.jobNames = jobNames;
}
@Deprecated
public int getCommandLineRunnerOrder() {
return this.commandLineRunnerOrder;
return this.applicationRunnerOrder;
}
@Deprecated
public void setCommandLineRunnerOrder(int commandLineRunnerOrder) {
this.commandLineRunnerOrder = commandLineRunnerOrder;
this.applicationRunnerOrder = commandLineRunnerOrder;
}
public int getApplicationRunnerOrder() {
return this.applicationRunnerOrder;
}
public void setApplicationRunnerOrder(int applicationRunnerOrder) {
this.applicationRunnerOrder = applicationRunnerOrder;
}
public long getFailOnJobFailurePollInterval() {

View File

@@ -72,7 +72,7 @@ public class TaskJobLauncherApplicationRunnerFactoryBean implements FactoryBean<
else {
this.jobName = taskBatchProperties.getJobNames();
}
this.order = taskBatchProperties.getCommandLineRunnerOrder();
this.order = taskBatchProperties.getApplicationRunnerOrder();
this.jobRepository = jobRepository;
}

View File

@@ -53,7 +53,7 @@ public class TaskJobLauncherAutoConfigurationTests {
@Test
public void testAutoBuiltDataSourceWithTaskJobLauncherCLROrder() {
this.contextRunner.withPropertyValues("spring.cloud.task.batch.fail-on-job-failure=true",
"spring.cloud.task.batch.commandLineRunnerOrder=100").run(context -> {
"spring.cloud.task.batch.applicationRunnerOrder=100").run(context -> {
assertThat(context.getBean(TaskJobLauncherApplicationRunner.class).getOrder()).isEqualTo(100);
});
}