Open allardmuis opened 5 years ago
Duplicate of https://github.com/inversify/InversifyJS/issues/678
After taking a better look it appears that issue 678 refers to different decorators, so not a duplicate after all.
I have it working with my own decorator instead of the decorator from inversify-inject-decorators. It is not ready for a pull request yet, for example because it doesn't support Named and Tagged services yet. Let me know of you are interested.
@allardmuis I'm currently facing this same problem, can I get you to share the work you've done on this issue?
I'm also facing this issue
+1
@allardmuis, can you share your code?
The lazyInject decorator appears to be a replacement for the constructor-injection. But the scoping rules don't work with lazy injection.
Expected Behavior
The 'lazyInject' decorator should inject the same instance when the binding is done in RequestScope.
Current Behavior
See this example code for an illustration:
The problem is that the lazyInject decorator uses
container.get
itself, creating a new request scope for every resolution.