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;
}
Aggregations