In my Dropwizard (1.2.4) application I'm having trouble injecting my Dropwizard configuration into classes that are instantiated by HK2. What's the best way to achieve this?
Just bind the configuration instance.
@Override
public void run(final DummyConfiguration conf, Environment env) {
env.jersey().register(new AbstractBinder() {
@Override
public void configure() {
bind(conf).to(DummyConfiguration.class);
}
})
}
Now you can @Inject
the DummyConfiguration
anywhere you need it.