Skip to content

Commit

Permalink
Revert "Add @ConditionalOnMissingBean for JobRepository"
Browse files Browse the repository at this point in the history
This reverts commit 73fc351.

See gh-43236
  • Loading branch information
wilkinsona committed Nov 21, 2024
1 parent d21952d commit 109e731
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

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;
Expand Down Expand Up @@ -130,13 +129,6 @@ protected DataSource getDataSource() {
return this.dataSource;
}

@Bean
@ConditionalOnMissingBean
@Override
public JobRepository jobRepository() throws BatchConfigurationException {
return super.jobRepository();
}

@Override
protected PlatformTransactionManager getTransactionManager() {
return this.transactionManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,6 @@ void defaultExecutionContextSerializerIsUsed() {
});
}

@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));
Expand Down Expand Up @@ -603,16 +596,6 @@ static class TestConfiguration {

}

@TestAutoConfigurationPackage(City.class)
static class TestConfigurationWithJobRepository {

@Bean
TestJobRepository jobRepository() {
return mock(TestJobRepository.class);
}

}

@Configuration(proxyBeanMethods = false)
static class EntityManagerFactoryConfiguration {

Expand Down Expand Up @@ -897,8 +880,4 @@ ExecutionContextSerializer executionContextSerializer() {

}

interface TestJobRepository extends JobRepository {

}

}

0 comments on commit 109e731

Please sign in to comment.