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

how to use containerModule to resolve dependencies from multiple top level modules ? #1466

Open
yichong96 opened this issue Jun 14, 2022 · 0 comments

Comments

@yichong96
Copy link

I have a dependency diagram as such in my application. I want to use the containerModule api of inversify to load my dependencies.

enter image description here

The dependency is from A -> B and C -> B. However, inversify does not allow for 'duplicate bindings'.

Suppose module D(the top level module) depends on Module A and C, then I would try to build the dependency graph from the bottom up starting from B -> (A + C) -> D. However, If I load containerModule B from containerModule A and containerModule C, and proceed to load containerModule A and containerModule C in containerModule D, I would have ambiguous bindings when I try to resolve my dependencies in in containerModule D because I would have loaded B dependencies twice in A and C.

What would be a best practice for dealing with such a situation ? I believe it would be quite common in OO applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant