@ -29,13 +29,13 @@ import org.springframework.context.ApplicationListener;
/ * *
/ * *
* Bean to handle { @link DataSource } initialization by running { @literal schema - * . sql } on
* Bean to handle { @link DataSource } initialization by running { @literal schema - * . sql } on
* { @link InitializingBean # afterPropertiesSet ( ) } and { @literal data - * . sql } SQL scripts on
* { @link InitializingBean # afterPropertiesSet ( ) } and { @literal data - * . sql } SQL scripts on
* a { @link DataSource Initializ edEvent} .
* a { @link DataSource SchemaCreat edEvent} .
*
*
* @author Stephane Nicoll
* @author Stephane Nicoll
* @see DataSourceAutoConfiguration
* @see DataSourceAutoConfiguration
* /
* /
class DataSourceInitializerInvoker
class DataSourceInitializerInvoker
implements ApplicationListener < DataSource Initializ edEvent> , InitializingBean {
implements ApplicationListener < DataSource SchemaCreat edEvent> , InitializingBean {
private static final Log logger = LogFactory . getLog ( DataSourceInitializerInvoker . class ) ;
private static final Log logger = LogFactory . getLog ( DataSourceInitializerInvoker . class ) ;
@ -65,7 +65,7 @@ class DataSourceInitializerInvoker
if ( schemaCreated ) {
if ( schemaCreated ) {
try {
try {
this . applicationContext
this . applicationContext
. publishEvent ( new DataSource Initializ edEvent(
. publishEvent ( new DataSource SchemaCreat edEvent(
initializer . getDataSource ( ) ) ) ;
initializer . getDataSource ( ) ) ) ;
// The listener might not be registered yet, so don't rely on it.
// The listener might not be registered yet, so don't rely on it.
if ( ! this . initialized ) {
if ( ! this . initialized ) {
@ -82,7 +82,7 @@ class DataSourceInitializerInvoker
}
}
@Override
@Override
public void onApplicationEvent ( DataSource Initializ edEvent event ) {
public void onApplicationEvent ( DataSource SchemaCreat edEvent event ) {
// NOTE the event can happen more than once and
// NOTE the event can happen more than once and
// the event datasource is not used here
// the event datasource is not used here
DataSourceInitializer initializer = getDataSourceInitializer ( ) ;
DataSourceInitializer initializer = getDataSourceInitializer ( ) ;