All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.vyarus.guicey.jdbi3.dbi.SimpleDbiProvider Maven / Gradle / Ivy

package ru.vyarus.guicey.jdbi3.dbi;

import io.dropwizard.core.Configuration;
import io.dropwizard.db.PooledDataSourceFactory;
import io.dropwizard.jdbi3.JdbiFactory;
import io.dropwizard.core.setup.Environment;
import org.jdbi.v3.core.Jdbi;

/**
 * Simple DBI configurer, requiring just database configuration.
 *
 * @param  configuration type
 * @author Vyacheslav Rusakov
 * @since 31.08.2018
 */
public class SimpleDbiProvider implements ConfigAwareProvider {

    private final ConfigAwareProvider database;

    public SimpleDbiProvider(final ConfigAwareProvider database) {
        this.database = database;
    }

    @Override
    public Jdbi get(final C configuration, final Environment environment) {
        return new JdbiFactory().build(environment, database.get(configuration, environment), "db");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy