Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindings to com.google.inject.Injector bind to bootstrap / parent injector instead of child injector #251

Closed
saeta opened this issue Oct 17, 2015 · 0 comments

Comments

@saeta
Copy link

saeta commented Oct 17, 2015

@coursera, we use Play!, which recently moved to pluggable DI implementations in Play 2.4. Previous to Play 2.4, we've been using Governator for lifecycle capabilities, among other things.

Play! attempts to be DI-framework agnostic, and has an abstraction of an Injector, with a default Guice implementation called GuiceInjector.

Unfortunately, when getting an instance of play.api.inject.Injector from the Governator child injector, the com.google.inject.Injector bound to the injector parameter of play.api.inject.guice.GuiceInjector is the Governator parent injector. This then causes all sorts of problems because bindings configured on the child injector are therefore not available on the bootstrap injector.

I have created a repro case (minimal sbt project), including a workround: include a parameter that can't be found from the bootstrap injector.

@saeta saeta closed this as completed Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant