use of io.dropwizard.db.PooledDataSourceFactory in project dropwizard by dropwizard.
the class AbstractLiquibaseCommand method run.
@Override
@SuppressWarnings("UseOfSystemOutOrSystemErr")
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
final PooledDataSourceFactory dbConfig = strategy.getDataSourceFactory(configuration);
dbConfig.asSingleConnectionPool();
try (final CloseableLiquibase liquibase = openLiquibase(dbConfig, namespace)) {
run(namespace, liquibase);
} catch (ValidationFailedException e) {
e.printDescriptiveError(System.err);
throw e;
}
}
use of io.dropwizard.db.PooledDataSourceFactory in project dropwizard by dropwizard.
the class HibernateBundle method run.
@Override
public final void run(T configuration, Environment environment) throws Exception {
final PooledDataSourceFactory dbConfig = getDataSourceFactory(configuration);
this.sessionFactory = sessionFactoryFactory.build(this, environment, dbConfig, entities, name());
registerUnitOfWorkListerIfAbsent(environment).registerSessionFactory(name(), sessionFactory);
environment.healthChecks().register(name(), new SessionFactoryHealthCheck(environment.getHealthCheckExecutorService(), dbConfig.getValidationQueryTimeout().orElse(Duration.seconds(5)), sessionFactory, dbConfig.getValidationQuery()));
}
Aggregations