Skip to content

Instantly share code, notes, and snippets.

@johnrengelman
Last active December 27, 2015 19:19
Show Gist options
  • Save johnrengelman/7375875 to your computer and use it in GitHub Desktop.
Save johnrengelman/7375875 to your computer and use it in GitHub Desktop.
Dropwizard Guice
dependencies {
// We use the latest groovy 2.x version for building this library
compile 'org.codehaus.groovy:groovy:2.1.7'
compile 'com.yammer.dropwizard:dropwizard-core:0.6.2'
compile 'com.hubspot.dropwizard:dropwizard-guice:0.6.2'
}
class EchoService extends Service<EchoConfiguration> {
public static void main(String[] args) {
new EchoService().run(args)
}
@Override
void initialize(Bootstrap<EchoConfiguration> bootstrap) {
bootstrap.addBundle(
GuiceBundle.<EchoConfiguration>newBuilder()
.addModule(new EchoModule())
.setConfigClass(EchoConfiguration)
.enableAutoConfig(this.class.package.name)
.build()
)
}
@Override
void run(EchoConfiguration configuration, Environment environment) throws Exception {
}
}
@kaaloo
Copy link

kaaloo commented Dec 20, 2013

A cool nice! Just what I was looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment