-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create unbound
@singleton
instances in the parent injector (#216)
This change introduces consistency to how instances for unbound classes decorated with a `@singleton` are shared among parent/child injectors, when auto-binding is enabled. Classes decorated with `@singleton`, that have not been explicitly bound, are now created by and bound to the parent injector closest to the root where all dependencies are fulfilled. The behavior was like this before, but only when the parent injector had created the singleton instance (and its implicit binding) before the child injector. This allows sharing singletons between child injectors without creating them on the parent injector first.
- Loading branch information
1 parent
87826b3
commit d00556c
Showing
3 changed files
with
193 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters