Search in sources :

Example 1 with ManagedDataSource

use of io.bootique.jdbc.managed.ManagedDataSource in project bootique-jdbc by bootique.

the class LazyDataSourceFactory method createManagedDataSource.

protected ManagedDataSource createManagedDataSource(String name) {
    ManagedDataSourceSupplier factory = dataSourceFactories.get(name);
    if (factory == null) {
        throw new IllegalStateException("No configuration present for DataSource named '" + name + "'");
    }
    String url = factory.getUrl();
    listeners.forEach(listener -> listener.beforeStartup(name, url));
    ManagedDataSource dataSource = factory.start();
    listeners.forEach(listener -> listener.afterStartup(name, url, dataSource.getDataSource()));
    return dataSource;
}
Also used : ManagedDataSourceSupplier(io.bootique.jdbc.managed.ManagedDataSourceSupplier) ManagedDataSource(io.bootique.jdbc.managed.ManagedDataSource)

Aggregations

ManagedDataSource (io.bootique.jdbc.managed.ManagedDataSource)1 ManagedDataSourceSupplier (io.bootique.jdbc.managed.ManagedDataSourceSupplier)1