private String initDB;
@Bean
public DataSourceInitializer dataSourceInitializer()
{
DataSourceInitializer dsInitializer = new DataSourceInitializer();
dsInitializer.setDataSource(dataSource);
String scripts = env.getProperty("scripts", "");
logger.debug("Init-db :"+initDB+", scripts: "+scripts);
if(Boolean.parseBoolean(initDB) && StringUtils.hasLength(scripts))
{
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
String[] files = scripts.split(",");
for (String file : files) {
databasePopulator.addScript(new ClassPathResource(file));
}
dsInitializer.setDatabasePopulator(databasePopulator);
}
return dsInitializer;
}