Closed vvondra closed 6 years ago
@heldeen I've rewritten this PR a bit
See what I meant above in this comment https://github.com/HubSpot/dropwizard-guice/pull/87#r97233832
I am not able to explicitly bind anything which relies on Provider
Now this PR adds a possibility to add Guice modules which are only added in the childInjector called in getInjector
when all the necessary parts are ready.
Now it passes all the existing test cases in the project + my new one.
I've kept the addModule
behaviour the same for backward compatibility.
Not going anywhere I suppose, and definitely out of my scope now, let's cleanup.
In the PR merging support for DW 1.0 I commented that injecting a
Provider<SecurityContext>
into our Guice bound services does not work anymore. https://github.com/HubSpot/dropwizard-guice/pull/86#discussion_r75580088It's due to the
baseInjector
not having theJerseyGuiceModule
installed. The child injectors used for AutoConfig, the one ingetInjector
and the one bridged to HK2 have it installed however.The code in the PR is more of an example of the set up we had (in the tests). The little hack installing
new JerseyGuiceModule(JerseyGuiceUtils.newServiceLocator())
intobaseInjector
however breaks two existing tests.Do you see any solution how to be able to inject Providers for Jersey-backed services?