Skip to content

Commit c663224

Browse files
committed
Merge branch '3.1.x'
Closes gh-38339
2 parents 18ad246 + 24cb05c commit c663224

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020

2121
import javax.sql.DataSource;
2222

23-
import org.springframework.batch.core.configuration.ListableJobLocator;
2423
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
2524
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
26-
import org.springframework.batch.core.converter.JobParametersConverter;
2725
import org.springframework.batch.core.explore.JobExplorer;
2826
import org.springframework.batch.core.launch.JobLauncher;
29-
import org.springframework.batch.core.launch.JobOperator;
30-
import org.springframework.batch.core.launch.support.SimpleJobOperator;
3127
import org.springframework.batch.core.repository.JobRepository;
3228
import org.springframework.beans.factory.ObjectProvider;
3329
import org.springframework.boot.ExitCodeGenerator;
@@ -95,20 +91,6 @@ public JobExecutionExitCodeGenerator jobExecutionExitCodeGenerator() {
9591
return new JobExecutionExitCodeGenerator();
9692
}
9793

98-
@Bean
99-
@ConditionalOnMissingBean(JobOperator.class)
100-
public SimpleJobOperator jobOperator(ObjectProvider<JobParametersConverter> jobParametersConverter,
101-
JobExplorer jobExplorer, JobLauncher jobLauncher, ListableJobLocator jobRegistry,
102-
JobRepository jobRepository) {
103-
SimpleJobOperator factory = new SimpleJobOperator();
104-
factory.setJobExplorer(jobExplorer);
105-
factory.setJobLauncher(jobLauncher);
106-
factory.setJobRegistry(jobRegistry);
107-
factory.setJobRepository(jobRepository);
108-
jobParametersConverter.ifAvailable(factory::setJobParametersConverter);
109-
return factory;
110-
}
111-
11294
@Configuration(proxyBeanMethods = false)
11395
static class SpringBootBatchConfiguration extends DefaultBatchConfiguration {
11496

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.springframework.batch.core.explore.JobExplorer;
4343
import org.springframework.batch.core.job.AbstractJob;
4444
import org.springframework.batch.core.launch.JobLauncher;
45+
import org.springframework.batch.core.launch.JobOperator;
4546
import org.springframework.batch.core.repository.JobRepository;
4647
import org.springframework.beans.BeansException;
4748
import org.springframework.beans.factory.annotation.Autowired;
@@ -110,8 +111,11 @@ void testDefaultContext() {
110111
this.contextRunner.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO))
111112
.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class)
112113
.run((context) -> {
114+
assertThat(context).hasSingleBean(JobRepository.class);
113115
assertThat(context).hasSingleBean(JobLauncher.class);
114116
assertThat(context).hasSingleBean(JobExplorer.class);
117+
assertThat(context).hasSingleBean(JobRegistry.class);
118+
assertThat(context).hasSingleBean(JobOperator.class);
115119
assertThat(context.getBean(BatchProperties.class).getJdbc().getInitializeSchema())
116120
.isEqualTo(DatabaseInitializationMode.EMBEDDED);
117121
assertThat(new JdbcTemplate(context.getBean(DataSource.class))

0 commit comments

Comments
 (0)