Removed Job and Step Builder factories.
Now using builders directly
This commit is contained in:
@@ -33,17 +33,17 @@ import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.support.RunIdIncrementer;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer;
|
||||
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
@@ -86,10 +86,6 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
|
||||
private TaskJobLauncherApplicationRunner runner;
|
||||
|
||||
private JobBuilderFactory jobs;
|
||||
|
||||
private StepBuilderFactory steps;
|
||||
|
||||
private Job job;
|
||||
|
||||
private Step step;
|
||||
@@ -97,11 +93,10 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
this.transactionManager = new ResourcelessTransactionManager();
|
||||
this.jobs = new JobBuilderFactory(this.jobRepository);
|
||||
this.steps = new StepBuilderFactory(this.jobRepository);
|
||||
Tasklet tasklet = (contribution, chunkContext) -> RepeatStatus.FINISHED;
|
||||
this.step = this.steps.get("step").tasklet(tasklet).transactionManager(this.transactionManager).build();
|
||||
this.job = this.jobs.get("job").start(this.step).build();
|
||||
this.step = new StepBuilder("step").repository(this.jobRepository).tasklet(tasklet)
|
||||
.transactionManager(this.transactionManager).build();
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository).start(this.step).build();
|
||||
this.runner = new TaskJobLauncherApplicationRunner(this.jobLauncher, this.jobExplorer, this.jobRepository,
|
||||
new TaskBatchProperties());
|
||||
|
||||
@@ -119,7 +114,8 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@DirtiesContext
|
||||
// @Test
|
||||
public void incrementExistingExecution() throws Exception {
|
||||
this.job = this.jobs.get("job").start(this.step).incrementer(new RunIdIncrementer()).build();
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository).start(this.step)
|
||||
.incrementer(new RunIdIncrementer()).build();
|
||||
this.runner.execute(this.job, new JobParameters());
|
||||
this.runner.execute(this.job, new JobParameters());
|
||||
assertThat(this.jobExplorer.getJobInstances("job", 0, 100)).hasSize(2);
|
||||
@@ -128,7 +124,8 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@DirtiesContext
|
||||
// @Test
|
||||
public void retryFailedExecution() throws Exception {
|
||||
this.job = this.jobs.get("job").start(this.steps.get("step").tasklet(throwingTasklet()).build())
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step").repository(this.jobRepository).tasklet(throwingTasklet()).build())
|
||||
.incrementer(new RunIdIncrementer()).build();
|
||||
runFailedJob(new JobParameters());
|
||||
runFailedJob(new JobParametersBuilder().addLong("run.id", 1L).toJobParameters());
|
||||
@@ -138,8 +135,9 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@DirtiesContext
|
||||
@Test
|
||||
public void runDifferentInstances() throws Exception {
|
||||
this.job = this.jobs.get("job").start(
|
||||
this.steps.get("step").tasklet(throwingTasklet()).transactionManager(this.transactionManager).build())
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step").repository(this.jobRepository).tasklet(throwingTasklet())
|
||||
.transactionManager(this.transactionManager).build())
|
||||
.build();
|
||||
// start a job instance
|
||||
JobParameters jobParameters = new JobParametersBuilder().addString("name", "foo").toJobParameters();
|
||||
@@ -154,8 +152,8 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@DirtiesContext
|
||||
@Test
|
||||
public void retryFailedExecutionOnNonRestartableJob() throws Exception {
|
||||
this.job = this.jobs
|
||||
.get("job").preventRestart().start(this.steps.get("step").tasklet(throwingTasklet())
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository).preventRestart()
|
||||
.start(new StepBuilder("step").repository(this.jobRepository).tasklet(throwingTasklet())
|
||||
.transactionManager(this.transactionManager).build())
|
||||
.incrementer(new RunIdIncrementer()).build();
|
||||
runFailedJob(new JobParameters());
|
||||
@@ -174,8 +172,8 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@DirtiesContext
|
||||
@Test
|
||||
public void retryFailedExecutionWithNonIdentifyingParameters() throws Exception {
|
||||
this.job = this.jobs
|
||||
.get("job").start(this.steps.get("step").tasklet(throwingTasklet())
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step").repository(this.jobRepository).tasklet(throwingTasklet())
|
||||
.transactionManager(this.transactionManager).build())
|
||||
.incrementer(new RunIdIncrementer()).build();
|
||||
JobParameters jobParameters = new JobParametersBuilder().addLong("id", 1L, false).addLong("foo", 2L, false)
|
||||
@@ -189,8 +187,8 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
@DirtiesContext
|
||||
@Test
|
||||
public void retryFailedExecutionWithDifferentNonIdentifyingParametersFromPreviousExecution() throws Exception {
|
||||
this.job = this.jobs
|
||||
.get("job").start(this.steps.get("step").tasklet(throwingTasklet())
|
||||
this.job = new JobBuilder("job").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step").repository(this.jobRepository).tasklet(throwingTasklet())
|
||||
.transactionManager(this.transactionManager).build())
|
||||
.incrementer(new RunIdIncrementer()).build();
|
||||
JobParameters jobParameters = new JobParametersBuilder().addLong("id", 1L, false).addLong("foo", 2L, false)
|
||||
@@ -285,7 +283,7 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
|
||||
@Override
|
||||
public JobLauncher getJobLauncher() throws Exception {
|
||||
SimpleJobLauncher launcher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher launcher = new TaskExecutorJobLauncher();
|
||||
|
||||
launcher.setJobRepository(getJobRepository());
|
||||
launcher.setTaskExecutor(new SyncTaskExecutor());
|
||||
|
||||
@@ -30,12 +30,13 @@ import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
@@ -184,23 +185,21 @@ public class TaskJobLauncherApplicationRunnerTests {
|
||||
public static class JobConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory stepBuilderFactory;
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
@Bean
|
||||
public Job job() {
|
||||
return this.jobBuilderFactory.get("job").start(this.stepBuilderFactory.get("step1").tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
return new JobBuilder("job").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step1").repository(this.jobRepository).tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -214,29 +213,28 @@ public class TaskJobLauncherApplicationRunnerTests {
|
||||
public static class JobWithFailureConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory stepBuilderFactory;
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
@Bean
|
||||
public Job jobFail() {
|
||||
return this.jobBuilderFactory.get("jobA").start(this.stepBuilderFactory.get("step1").tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
||||
System.out.println("Executed");
|
||||
throw new IllegalStateException("WHOOPS");
|
||||
}
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
return new JobBuilder("jobA").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step1").repository(this.jobRepository).tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
|
||||
throws Exception {
|
||||
System.out.println("Executed");
|
||||
throw new IllegalStateException("WHOOPS");
|
||||
}
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Job jobFun() {
|
||||
return this.jobBuilderFactory.get("jobSucceed")
|
||||
.start(this.stepBuilderFactory.get("step1Succeed").tasklet(new Tasklet() {
|
||||
return new JobBuilder("jobSucceed").repository(this.jobRepository)
|
||||
.start(new StepBuilder("step1Succeed").repository(this.jobRepository).tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
|
||||
System.out.println("Executed");
|
||||
@@ -270,7 +268,7 @@ public class TaskJobLauncherApplicationRunnerTests {
|
||||
}
|
||||
|
||||
protected JobLauncher createJobLauncher() throws Exception {
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(getJobRepository());
|
||||
jobLauncher.setTaskExecutor(new ConcurrentTaskExecutor());
|
||||
jobLauncher.afterPropertiesSet();
|
||||
|
||||
@@ -25,8 +25,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -73,9 +74,9 @@ public class PrefixTests {
|
||||
public static class JobConfiguration {
|
||||
|
||||
@Bean
|
||||
public Job job(JobBuilderFactory jobBuilderFactory, StepBuilderFactory stepBuilderFactory) {
|
||||
return jobBuilderFactory.get("job")
|
||||
.start(stepBuilderFactory.get("step1").tasklet((contribution, chunkContext) -> {
|
||||
public Job job(JobRepository jobRepository) {
|
||||
return new JobBuilder("job").repository(jobRepository)
|
||||
.start(new StepBuilder("step1").repository(jobRepository).tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(new ResourcelessTransactionManager()).build()).build();
|
||||
|
||||
@@ -25,8 +25,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -72,9 +73,9 @@ class PrimaryKeyTests {
|
||||
static class JobConfiguration {
|
||||
|
||||
@Bean
|
||||
Job job(JobBuilderFactory jobBuilderFactory, StepBuilderFactory stepBuilderFactory) {
|
||||
return jobBuilderFactory.get("job")
|
||||
.start(stepBuilderFactory.get("step1").tasklet((contribution, chunkContext) -> {
|
||||
Job job(JobRepository jobRepository) {
|
||||
return new JobBuilder("job").repository(jobRepository)
|
||||
.start(new StepBuilder("step1").repository(jobRepository).tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(new ResourcelessTransactionManager()).build()).build();
|
||||
|
||||
@@ -31,10 +31,11 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.job.SimpleJob;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
@@ -282,18 +283,15 @@ public class TaskBatchExecutionListenerTests {
|
||||
public static class JobConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory stepBuilderFactory;
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
@Bean
|
||||
public Job job() {
|
||||
return this.jobBuilderFactory.get("job")
|
||||
.start(this.stepBuilderFactory.get("step1").tasklet((contribution, chunkContext) -> {
|
||||
return new JobBuilder("job").repository(this.jobRepository).start(
|
||||
new StepBuilder("step1").repository(this.jobRepository).tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(this.transactionManager).build()).build();
|
||||
@@ -307,21 +305,18 @@ public class TaskBatchExecutionListenerTests {
|
||||
public static class TaskNotEnabledConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory stepBuilderFactory;
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
PlatformTransactionManager transactionManager;
|
||||
|
||||
@Bean
|
||||
public Job job() {
|
||||
return this.jobBuilderFactory.get("job")
|
||||
.start(this.stepBuilderFactory.get("step1").tasklet((contribution, chunkContext) -> {
|
||||
return new JobBuilder("job").start(
|
||||
new StepBuilder("step1").repository(this.jobRepository).tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
}).transactionManager(transactionManager).build()).repository(this.jobRepository).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -333,10 +328,7 @@ public class TaskBatchExecutionListenerTests {
|
||||
public static class JobFactoryBeanConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory stepBuilderFactory;
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
@@ -346,13 +338,12 @@ public class TaskBatchExecutionListenerTests {
|
||||
return new FactoryBean<Job>() {
|
||||
@Override
|
||||
public Job getObject() {
|
||||
return JobFactoryBeanConfiguration.this.jobBuilderFactory.get("job")
|
||||
.start(JobFactoryBeanConfiguration.this.stepBuilderFactory.get("step1")
|
||||
.tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(transactionManager).build())
|
||||
.build();
|
||||
return new JobBuilder("job")
|
||||
.start(new StepBuilder("step1").tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(transactionManager).repository(jobRepository).build())
|
||||
.repository(jobRepository).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -376,14 +367,17 @@ public class TaskBatchExecutionListenerTests {
|
||||
public static class JobConfigurationMultipleDataSources {
|
||||
|
||||
@Bean
|
||||
public Job job(JobBuilderFactory jobBuilderFactory, StepBuilderFactory stepBuilderFactory) {
|
||||
return jobBuilderFactory.get("job").start(stepBuilderFactory.get("step1").tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}
|
||||
}).transactionManager(new ResourcelessTransactionManager()).build()).build();
|
||||
public Job job(JobRepository jobRepository) {
|
||||
return new JobBuilder("job").repository(jobRepository)
|
||||
.start(new StepBuilder("step1").tasklet(new Tasklet() {
|
||||
@Override
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
|
||||
throws Exception {
|
||||
System.out.println("Executed");
|
||||
return RepeatStatus.FINISHED;
|
||||
}
|
||||
}).transactionManager(new ResourcelessTransactionManager()).repository(jobRepository).build())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -420,30 +414,27 @@ public class TaskBatchExecutionListenerTests {
|
||||
public static class MultipleJobConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory stepBuilderFactory;
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
@Bean
|
||||
public Job job1() {
|
||||
return this.jobBuilderFactory.get("job1")
|
||||
.start(this.stepBuilderFactory.get("job1step1").tasklet((contribution, chunkContext) -> {
|
||||
return new JobBuilder("job1").repository(this.jobRepository)
|
||||
.start(new StepBuilder("job1step1").tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed job1");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
}).transactionManager(transactionManager).repository(this.jobRepository).build()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Job job2() {
|
||||
return this.jobBuilderFactory.get("job2")
|
||||
.start(this.stepBuilderFactory.get("job2step1").tasklet((contribution, chunkContext) -> {
|
||||
return new JobBuilder("job2").repository(this.jobRepository)
|
||||
.start(new StepBuilder("job2step1").tasklet((contribution, chunkContext) -> {
|
||||
System.out.println("Executed job2");
|
||||
return RepeatStatus.FINISHED;
|
||||
}).transactionManager(transactionManager).build()).build();
|
||||
}).transactionManager(transactionManager).repository(this.jobRepository).build()).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user