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
e6c18a00
Commit
e6c18a00
authored
Aug 22, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
77bf5583
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
DataSourceAutoConfiguration.java
.../boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
+6
-3
DataSourceProperties.java
...amework/boot/autoconfigure/jdbc/DataSourceProperties.java
+1
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
View file @
e6c18a00
...
...
@@ -97,8 +97,8 @@ public class DataSourceAutoConfiguration {
@Autowired
private
DataSourceProperties
properties
;
@ConfigurationProperties
(
prefix
=
DataSourceProperties
.
PREFIX
)
@Bean
@ConfigurationProperties
(
prefix
=
DataSourceProperties
.
PREFIX
)
public
DataSource
dataSource
()
{
DataSourceBuilder
factory
=
DataSourceBuilder
.
create
(
this
.
properties
.
getClassLoader
())
...
...
@@ -205,8 +205,7 @@ public class DataSourceAutoConfiguration {
return
ConditionOutcome
.
match
(
"existing auto database detected"
);
}
if
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
(
context
.
getBeanFactory
(),
DataSource
.
class
,
true
,
false
).
length
>
0
)
{
if
(
hasBean
(
context
,
DataSource
.
class
))
{
return
ConditionOutcome
.
match
(
"Existing bean configured database detected"
);
}
...
...
@@ -214,6 +213,10 @@ public class DataSourceAutoConfiguration {
return
ConditionOutcome
.
noMatch
(
"no existing bean configured database"
);
}
private
boolean
hasBean
(
ConditionContext
context
,
Class
<?>
type
)
{
return
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
(
context
.
getBeanFactory
(),
type
,
true
,
false
).
length
>
0
;
}
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java
View file @
e6c18a00
...
...
@@ -25,7 +25,7 @@ import org.springframework.util.ClassUtils;
import
org.springframework.util.StringUtils
;
/**
* Base class for configuration of a data
base pool
.
* Base class for configuration of a data
source
.
*
* @author Dave Syer
* @author Maciej Walkowiak
...
...
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