{
DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
String dbInitializationEnabled = env.resolvePlaceholders("${jdbc.init-db}");
dataSourceInitializer.setEnabled(Boolean.parseBoolean(dbInitializationEnabled));
dataSourceInitializer.setDataSource(dataSource);
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
String dbInitScriptLocation = env.resolvePlaceholders("${jdbc.initLocation}");
if(StringUtils.isNotEmpty(dbInitScriptLocation))
{
databasePopulator.setScripts(new Resource[]{
new ClassPathResource(dbInitScriptLocation)
});
}
dataSourceInitializer.setDatabasePopulator(databasePopulator);
return dataSourceInitializer;