You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are no cleanup scripts (no entries with execution="DESTROY"), yet the DataSourceInitializer bean tries to open a database connection when the context is shutting down. This slows down the shutdown process, especially when the connection times out.
The source code of DataSourceInitializer contains a null check on this.databaseCleaner:
@Override
public void destroy() {
execute(this.databaseCleaner);
}
private void execute(DatabasePopulator populator) {
Assert.state(this.dataSource != null, "DataSource must be set");
if (this.enabled && populator != null) {
DatabasePopulatorUtils.execute(populator, this.dataSource);
}
}
However, DatabasePopulatorConfigUtils.setDatabasePopulator always creates a non-null value for databaseCleaner, even if the object is effectively a no-op.
The problem happens in spring-jdbc 4.3.14 and 5.1.7
The text was updated successfully, but these errors were encountered:
MateuszStefek
changed the title
InitializeDatabaseBeanDefinitionParser creates non-null value DatasourceInitialier.databaseCleaner even if there are no cleanup scripts
InitializeDatabaseBeanDefinitionParser sets a non-null DatasourceInitialier.databaseCleaner even if there are no cleanup scripts
Aug 2, 2019
snicoll
changed the title
InitializeDatabaseBeanDefinitionParser sets a non-null DatasourceInitialier.databaseCleaner even if there are no cleanup scripts
DatabasePopulatorConfigUtils should only set a populator if matching scripts are defined
Sep 25, 2023
In my project, we define database initialization scripts via
jdbc:initialize-database
element.There are no cleanup scripts (no entries with
execution="DESTROY"
), yet theDataSourceInitializer
bean tries to open a database connection when the context is shutting down. This slows down the shutdown process, especially when the connection times out.The source code of
DataSourceInitializer
contains a null check onthis.databaseCleaner
:However,
DatabasePopulatorConfigUtils.setDatabasePopulator
always creates a non-null value fordatabaseCleaner
, even if the object is effectively a no-op.The problem happens in spring-jdbc 4.3.14 and 5.1.7
The text was updated successfully, but these errors were encountered: