Skip to content

Commit 109e731

Browse files
committed
Revert "Add @ConditionalOnMissingBean for JobRepository"
This reverts commit 73fc351. See gh-43236
1 parent d21952d commit 109e731

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

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

-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import javax.sql.DataSource;
2222

23-
import org.springframework.batch.core.configuration.BatchConfigurationException;
2423
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
2524
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
2625
import org.springframework.batch.core.explore.JobExplorer;
@@ -130,13 +129,6 @@ protected DataSource getDataSource() {
130129
return this.dataSource;
131130
}
132131

133-
@Bean
134-
@ConditionalOnMissingBean
135-
@Override
136-
public JobRepository jobRepository() throws BatchConfigurationException {
137-
return super.jobRepository();
138-
}
139-
140132
@Override
141133
protected PlatformTransactionManager getTransactionManager() {
142134
return this.transactionManager;

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

-21
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,6 @@ void defaultExecutionContextSerializerIsUsed() {
517517
});
518518
}
519519

520-
@Test
521-
void defaultJobRepositoryIsNotCreatedWhenUserDefinedJobRepositoryBean() {
522-
this.contextRunner
523-
.withUserConfiguration(TestConfigurationWithJobRepository.class, EmbeddedDataSourceConfiguration.class)
524-
.run((context) -> assertThat(context).hasSingleBean(TestJobRepository.class));
525-
}
526-
527520
private JobLauncherApplicationRunner createInstance(String... registeredJobNames) {
528521
JobLauncherApplicationRunner runner = new JobLauncherApplicationRunner(mock(JobLauncher.class),
529522
mock(JobExplorer.class), mock(JobRepository.class));
@@ -603,16 +596,6 @@ static class TestConfiguration {
603596

604597
}
605598

606-
@TestAutoConfigurationPackage(City.class)
607-
static class TestConfigurationWithJobRepository {
608-
609-
@Bean
610-
TestJobRepository jobRepository() {
611-
return mock(TestJobRepository.class);
612-
}
613-
614-
}
615-
616599
@Configuration(proxyBeanMethods = false)
617600
static class EntityManagerFactoryConfiguration {
618601

@@ -897,8 +880,4 @@ ExecutionContextSerializer executionContextSerializer() {
897880

898881
}
899882

900-
interface TestJobRepository extends JobRepository {
901-
902-
}
903-
904883
}

0 commit comments

Comments
 (0)