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
a608e099
Commit
a608e099
authored
Jan 17, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
19b27944
e19400ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
DataSourceAutoConfiguration.java
.../boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
+6
-3
DataSourceInitializer.java
...mework/boot/autoconfigure/jdbc/DataSourceInitializer.java
+11
-8
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
View file @
a608e099
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -40,6 +40,7 @@ import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
...
@@ -40,6 +40,7 @@ import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerPostProcessor.Registrar
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerPostProcessor.Registrar
;
import
org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration
;
import
org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Condition
;
import
org.springframework.context.annotation.Condition
;
import
org.springframework.context.annotation.ConditionContext
;
import
org.springframework.context.annotation.ConditionContext
;
...
@@ -57,6 +58,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
...
@@ -57,6 +58,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
* @author Dave Syer
* @author Dave Syer
* @author Phillip Webb
* @author Phillip Webb
* @author Stephane Nicoll
* @author Stephane Nicoll
* @author Kazuki Shimizu
*/
*/
@Configuration
@Configuration
@ConditionalOnClass
({
DataSource
.
class
,
EmbeddedDatabaseType
.
class
})
@ConditionalOnClass
({
DataSource
.
class
,
EmbeddedDatabaseType
.
class
})
...
@@ -69,8 +71,9 @@ public class DataSourceAutoConfiguration {
...
@@ -69,8 +71,9 @@ public class DataSourceAutoConfiguration {
@Bean
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean
public
DataSourceInitializer
dataSourceInitializer
()
{
public
DataSourceInitializer
dataSourceInitializer
(
return
new
DataSourceInitializer
();
DataSourceProperties
properties
,
ApplicationContext
applicationContext
)
{
return
new
DataSourceInitializer
(
properties
,
applicationContext
);
}
}
/**
/**
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java
View file @
a608e099
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -26,10 +26,9 @@ import javax.sql.DataSource;
...
@@ -26,10 +26,9 @@ import javax.sql.DataSource;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.config.ResourceNotFoundException
;
import
org.springframework.boot.context.config.ResourceNotFoundException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.jdbc.config.SortedResourcesFactoryBean
;
import
org.springframework.jdbc.config.SortedResourcesFactoryBean
;
import
org.springframework.jdbc.datasource.init.DatabasePopulatorUtils
;
import
org.springframework.jdbc.datasource.init.DatabasePopulatorUtils
;
...
@@ -45,6 +44,7 @@ import org.springframework.util.StringUtils;
...
@@ -45,6 +44,7 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb
* @author Phillip Webb
* @author Eddú Meléndez
* @author Eddú Meléndez
* @author Stephane Nicoll
* @author Stephane Nicoll
* @author Kazuki Shimizu
* @since 1.1.0
* @since 1.1.0
* @see DataSourceAutoConfiguration
* @see DataSourceAutoConfiguration
*/
*/
...
@@ -52,16 +52,19 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
...
@@ -52,16 +52,19 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
private
static
final
Log
logger
=
LogFactory
.
getLog
(
DataSourceInitializer
.
class
);
private
static
final
Log
logger
=
LogFactory
.
getLog
(
DataSourceInitializer
.
class
);
@Autowired
private
final
DataSourceProperties
properties
;
private
ConfigurableApplicationContext
applicationContext
;
private
DataSource
dataSource
;
private
final
ApplicationContext
applicationContext
;
@Autowired
private
DataSource
dataSource
;
private
DataSourceProperties
properties
;
private
boolean
initialized
=
false
;
private
boolean
initialized
=
false
;
DataSourceInitializer
(
DataSourceProperties
properties
,
ApplicationContext
applicationContext
)
{
this
.
properties
=
properties
;
this
.
applicationContext
=
applicationContext
;
}
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
if
(!
this
.
properties
.
isInitialize
())
{
if
(!
this
.
properties
.
isInitialize
())
{
...
...
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