package com.dmnlk.sample;

import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;

/**
 * @author dmnlk
 */
public class SampleApplication extends Application<SampleConfiguration> {
    public static void main(String[] args) throws  Exception {
        new SampleApplication().run(args);
    }

    @Override
    public String getName() {
        return "hello";
    }

    @Override
    public void initialize(Bootstrap<SampleConfiguration> bootstrap) {
        // nothing to do yet
    }

    @Override
    public void run(SampleConfiguration configuration,
                    Environment environment) {
       final SampleResource resource = new SampleResource(
               configuration.getTemplate(),
               configuration.getDefaultName()
       );

        final TemplateHealthCheck healthCheck = new TemplateHealthCheck(configuration.getTemplate());
        environment.healthChecks().register("template", healthCheck);
        environment.jersey().register(resource);
    }
}

@@ -54,16 +54,54 @@
 cation;%0A
+import io.dropwizard.jdbi.DBIFactory;%0A
 import i
@@ -169,16 +169,46 @@
 ronment;
+%0Aimport org.skife.jdbi.v2.DBI;
 %0A%0A/**%0A *
@@ -1105,16 +1105,189 @@
 source);
+%0A%0A        final DBIFactory dbiFactory = new DBIFactory();%0A        final DBI dbi = dbiFactory.build(environment, configuration.getDataSourceFactory(), %22postgresql%22);%0A        
 %0A    %7D%0A%7D

add JDBI Config