Skip to content

Commit

Permalink
Replace deprecated SimpleJobLauncher with TaskExecutorJobLauncher
Browse files Browse the repository at this point in the history
resolves #6059

Signed-off-by: Glenn Renfro <[email protected]>
  • Loading branch information
cppwfs committed Nov 12, 2024
1 parent 54aca00 commit ff88216
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import javax.sql.DataSource;

import org.springframework.batch.core.explore.JobExplorer;
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.item.database.support.DataFieldMaxValueIncrementerFactory;
import org.springframework.beans.BeanUtils;
Expand Down Expand Up @@ -115,7 +115,7 @@ public JobService jobService(DataSource dataSource, PlatformTransactionManager p
factoryBean.setEnvironment(environment);
factoryBean.setDataSource(dataSource);
factoryBean.setTransactionManager(platformTransactionManager);
factoryBean.setJobLauncher(new SimpleJobLauncher());
factoryBean.setJobLauncher(new TaskExecutorJobLauncher());
factoryBean.setJobExplorer(jobExplorer);
factoryBean.setJobRepository(jobRepository);
factoryBean.setSerializer(new AllInOneExecutionContextSerializer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.launch.JobExecutionNotRunningException;
import org.springframework.batch.core.launch.NoSuchJobExecutionException;
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
import org.testcontainers.containers.JdbcDatabaseContainer;

import org.springframework.batch.core.BatchStatus;
Expand All @@ -40,7 +41,6 @@
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
import org.springframework.batch.core.launch.NoSuchJobInstanceException;
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.dao.JdbcStepExecutionDao;
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
Expand Down Expand Up @@ -374,7 +374,7 @@ public JobService jobService(DataSource dataSource,
factoryBean.setEnvironment(environment);
factoryBean.setDataSource(dataSource);
factoryBean.setTransactionManager(platformTransactionManager);
factoryBean.setJobLauncher(new SimpleJobLauncher());
factoryBean.setJobLauncher(new TaskExecutorJobLauncher());
factoryBean.setJobExplorer(jobExplorer);
factoryBean.setJobRepository(jobRepository);
factoryBean.setSerializer(new AllInOneExecutionContextSerializer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.springframework.batch.core.JobParametersIncrementer;
import org.springframework.batch.core.JobParametersValidator;
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.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -185,7 +185,7 @@ public static class DefaultTaskDeleteServiceNoChunkTests extends DefaultTaskDele
}

JobLauncher jobLauncher(JobRepository jobRepository) {
SimpleJobLauncher launcher = new SimpleJobLauncher();
TaskExecutorJobLauncher launcher = new TaskExecutorJobLauncher();
launcher.setJobRepository(jobRepository);
launcher.setTaskExecutor(task -> {
});
Expand Down

0 comments on commit ff88216

Please sign in to comment.