use of org.testcontainers.containers.Db2Container in project spring-data-jdbc by spring-projects.
the class Db2DataSourceConfiguration method createDataSource.
/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.testing.DataSourceConfiguration#createDataSource()
*/
@Override
protected DataSource createDataSource() {
if (DB_2_CONTAINER == null) {
LOG.info("DB2 starting...");
Db2Container container = new Db2Container().withReuse(true);
container.start();
LOG.info("DB2 started");
DB_2_CONTAINER = container;
}
return new DriverManagerDataSource(DB_2_CONTAINER.getJdbcUrl(), DB_2_CONTAINER.getUsername(), DB_2_CONTAINER.getPassword());
}
Aggregations