DataSource dataSource = ctx.getBean(DataSource.class);
@SuppressWarnings("unchecked")
List<Resource> databaseScripts = (List<Resource>) ctx.getBean("databaseScriptsList");
Connection con = null;
ResourceDatabasePopulator resourceDatabasePopulator = new ResourceDatabasePopulator();
try {
con = dataSource.getConnection();
resourceDatabasePopulator.setScripts(databaseScripts.toArray(new Resource[0]));
resourceDatabasePopulator.populate(con);
} catch (SQLException e) {
logger.error(e.getMessage(), e);
} finally {
try { con.close(); } catch (Exception e) {}
}