Skip to content

Instantly share code, notes, and snippets.

@cemo
Forked from christophercurrie/gist:3841860
Created October 5, 2012 19:58
Show Gist options
  • Save cemo/3842008 to your computer and use it in GitHub Desktop.
Save cemo/3842008 to your computer and use it in GitHub Desktop.
Guice for Dropwizard
@Override
public ServletContainer getJerseyContainer(DropwizardResourceConfig resourceConfig,
MyServiceConfig serviceConfig) {
// I like having a root module, but you can use as many as you like
final Injector injector = Guice.createInjector(new MyServiceModule(serviceConfig));
return new GuiceContainer(injector) {
@Override
public ResourceConfig getDefaultResourceConfig(Map<String,Object> props, WebConfig webConfig) {
return resourceConfig;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment