public DataSource datasource() {
EmbeddedDatabaseFactoryBean bean = new EmbeddedDatabaseFactoryBean();
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
databasePopulator.addScript(new ClassPathResource("hibernate/config/java/schema.sql"));
bean.setDatabasePopulator(databasePopulator);
bean.afterPropertiesSet(); // necessary because
// EmbeddedDatabaseFactoryBean is a
// FactoryBean
return bean.getObject();
}