This is a fork of HubSpot/dropwizard-guicier with following modifications:
- Significant reduction in dependency footprint
- Reduction in inter-dependency conflicts (hence, lesser chances of jar hell)
- Compatilibity with latest versions of Dropwizard
Add this library (dropwizard-guicier
) as dependency:
<dependencies>
<dependency>
<groupId>com.flipkart.utils</groupId>
<artifactId>dropwizard-guicier</artifactId>
<version>${dropwizard-guicier-version}</version>
</dependency>
</dependencies>
As of now, following versions of ${dropwizard-guicier-version}
are available in Maven Central Artifactory:
Dropwizard version | Guice version | dropwizard-guicier-version |
---|---|---|
1.3.5 | 4.2.2 | 1.3.5-2 |
1.3.17 | 4.2.2 | 1.3.17-1 |
1.3.18 | 4.2.2 | 1.3.18-1 |
1.3.19 | 4.2.2 | 1.3.19-1 |
If you have a version of Dropwizard or Guice that isn't listed here, raise an issue or you can build one yourself.
Simply install a new instance of the bundle during your service initialization:
public class ExampleApplication extends Application<ExampleConfiguration> {
public static void main(String... args) throws Exception {
new ExampleApplication().run(args);
}
@Override
public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
GuiceBundle<ExampleConfiguration> guiceBundle = GuiceBundle.defaultBuilder(ExampleConfiguration.class)
.modules(new ExampleModule())
.build();
bootstrap.addBundle(guiceBundle);
}
@Override
public void run(ExampleConfiguration configuration, Environment environment) throws Exception {}
}