Open GoogleCodeExporter opened 9 years ago
Probably related to issue702
Original comment by wixner@gmail.com
on 2 Aug 2012 at 12:45
upload new test without the @Ignore annotation
Original comment by wixner@gmail.com
on 2 Aug 2012 at 1:04
Attachments:
Somewhat unfortunately, this is working-as-designed.
Because of the way just-in-time-bindings work, in the HelloModulePrivate, Guice
does not know that the statement:
bind(HelloWord.class).to(HelloWorldImpl.class)
also means that 'HelloWorldImpl' is 'private'. The statement is only saying,
"Link HelloWorld to HelloWordImpl". Because of that, HelloWordImpl is actually
being bound in the parent module, and the interceptor in the private module
can't see it.
This is why HelloModulePrivateNoInterface works -- you have a separate
bind(HelloWorldImpl.class) line, telling Guice that HelloWorldImpl wants to be
private.
If you add that bind statement (doesn't need to be a singleton as it is in
HelloModulePrivateNoInterface) in the HelloModulePrivate, then things will
start working.
Another fix would be to add 'binder().requireExplicitBindings()' to the parent
Module, and that will tell Guice that you don't want just-in-time bindings at
all, and everything should exist in the Module is was declared in.
Original comment by sberlin
on 2 Aug 2012 at 1:27
A bit surprising, but both your solutions work fine for me.
Many thanks for the prompt and useful reply!
Original comment by wixner@gmail.com
on 2 Aug 2012 at 2:02
Original issue reported on code.google.com by
wixner@gmail.com
on 2 Aug 2012 at 12:44Attachments: