Open GoogleCodeExporter opened 9 years ago
You need to explicitly bind the concrete type in the child module. Add this
line to
TestModule, and things will work as you intend:
bind(concreteType);
This requirement is in the documentation for createChildInjector():
"Just-in-time bindings created for child injectors will be created in an ancestor
injector whenever possible. This allows for scoped instances to be shared
between
injectors. Use explicit bindings to prevent bindings from being shared with the
parent injector."
Original comment by limpbizkit
on 21 Jan 2010 at 8:49
OK. "bind(concreteType)" is a fine work around. This feels leaky abstraction,
but the workaround is clear.
I guess I didn't understand that the target of a binding is a just-in-time
binding in the same way an unbound
type is. I guess this is what Bob Lee meant in issue#342 about JIT bindings
from the user's perspective. Oh
well, fair enough.
I wonder if it's still very much a bug that, for the purpose of deciding if a
class can be created in a parent
injector, the interceptors are not considered dependencies in the same way
things marked with @Inject are?
Thanks Jessie.
Original comment by gil...@gmail.com
on 21 Jan 2010 at 5:31
Original issue reported on code.google.com by
gil...@gmail.com
on 20 Jan 2010 at 11:32