Revert "Add @ConditionalOnMissingBean for JobRepository"
This reverts commit 73fc351d71.
See gh-43236
This commit is contained in:
@@ -20,7 +20,6 @@ import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.batch.core.configuration.BatchConfigurationException;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
@@ -130,13 +129,6 @@ public class BatchAutoConfiguration {
|
||||
return this.dataSource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Override
|
||||
public JobRepository jobRepository() throws BatchConfigurationException {
|
||||
return super.jobRepository();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlatformTransactionManager getTransactionManager() {
|
||||
return this.transactionManager;
|
||||
|
||||
@@ -517,13 +517,6 @@ class BatchAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void defaultJobRepositoryIsNotCreatedWhenUserDefinedJobRepositoryBean() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestConfigurationWithJobRepository.class, EmbeddedDataSourceConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasSingleBean(TestJobRepository.class));
|
||||
}
|
||||
|
||||
private JobLauncherApplicationRunner createInstance(String... registeredJobNames) {
|
||||
JobLauncherApplicationRunner runner = new JobLauncherApplicationRunner(mock(JobLauncher.class),
|
||||
mock(JobExplorer.class), mock(JobRepository.class));
|
||||
@@ -603,16 +596,6 @@ class BatchAutoConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
@TestAutoConfigurationPackage(City.class)
|
||||
static class TestConfigurationWithJobRepository {
|
||||
|
||||
@Bean
|
||||
TestJobRepository jobRepository() {
|
||||
return mock(TestJobRepository.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class EntityManagerFactoryConfiguration {
|
||||
|
||||
@@ -897,8 +880,4 @@ class BatchAutoConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
interface TestJobRepository extends JobRepository {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user