Merge branch '2.1.x'

Closes gh-17453
This commit is contained in:
Andy Wilkinson
2019-07-08 14:44:34 +01:00
2 changed files with 8 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ import org.springframework.transaction.PlatformTransactionManager;
class BatchConfigurerConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(DataSource.class)
@ConditionalOnMissingBean(name = "entityManagerFactory")
static class JdbcBatchConfiguration {

View File

@@ -91,7 +91,13 @@ class BatchAutoConfigurationTests {
}
@Test
void testNoDatabase() {
void whenThereIsNoDataSourceAutoConfigurationBacksOff() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.run((context) -> assertThat(context).doesNotHaveBean(BatchConfigurer.class));
}
@Test
void testCustomConfigurationWithNoDatabase() {
this.contextRunner.withUserConfiguration(TestCustomConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(JobLauncher.class);
JobExplorer explorer = context.getBean(JobExplorer.class);