Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a023f308
Commit
a023f308
authored
Jul 08, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make JDBC-based batch configurer back off without a DataSource
Closes gh-17449
parent
7f85aba5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
BatchConfigurerConfiguration.java
...oot/autoconfigure/batch/BatchConfigurerConfiguration.java
+1
-0
BatchAutoConfigurationTests.java
...boot/autoconfigure/batch/BatchAutoConfigurationTests.java
+7
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchConfigurerConfiguration.java
View file @
a023f308
...
@@ -40,6 +40,7 @@ import org.springframework.transaction.PlatformTransactionManager;
...
@@ -40,6 +40,7 @@ import org.springframework.transaction.PlatformTransactionManager;
class
BatchConfigurerConfiguration
{
class
BatchConfigurerConfiguration
{
@Configuration
@Configuration
@ConditionalOnBean
(
DataSource
.
class
)
@ConditionalOnMissingBean
(
name
=
"entityManagerFactory"
)
@ConditionalOnMissingBean
(
name
=
"entityManagerFactory"
)
static
class
JdbcBatchConfiguration
{
static
class
JdbcBatchConfiguration
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java
View file @
a023f308
...
@@ -89,7 +89,13 @@ public class BatchAutoConfigurationTests {
...
@@ -89,7 +89,13 @@ public class BatchAutoConfigurationTests {
}
}
@Test
@Test
public
void
testNoDatabase
()
{
public
void
whenThereIsNoDataSourceAutoConfigurationBacksOff
()
{
this
.
contextRunner
.
withUserConfiguration
(
TestConfiguration
.
class
)
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
BatchConfigurer
.
class
));
}
@Test
public
void
testCustomConfigurationWithNoDatabase
()
{
this
.
contextRunner
.
withUserConfiguration
(
TestCustomConfiguration
.
class
).
run
((
context
)
->
{
this
.
contextRunner
.
withUserConfiguration
(
TestCustomConfiguration
.
class
).
run
((
context
)
->
{
assertThat
(
context
).
hasSingleBean
(
JobLauncher
.
class
);
assertThat
(
context
).
hasSingleBean
(
JobLauncher
.
class
);
JobExplorer
explorer
=
context
.
getBean
(
JobExplorer
.
class
);
JobExplorer
explorer
=
context
.
getBean
(
JobExplorer
.
class
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment