Last active
December 27, 2015 19:19
-
-
Save johnrengelman/7375875 to your computer and use it in GitHub Desktop.
Dropwizard Guice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A cool nice! Just what I was looking for.