Search code examples
javaguicedropwizardmorphia

How to access the Guice Module instance from application(dropwizard) run() method


I need to set an attribute to my guice module from the run() method of my application. How do I get hold of the module instance.

How will this guy implement his run() method - https://stackoverflow.com/a/28088545/8788071

I tried doing - SalModule module = guiceBundle.getInjector().getInstance(SalModule.class);

but its trying to create a new instance as the constructer requires arguments.


Solution

  • I just had to remember the reference of the guice module created in the initialize() method of the application, when passing it to create a guice bundle.