Updates:
        Status: WorkingAsIntended

Comment #3 on issue 722 by sberlin: PrivateModule prevents interceptors to be applied
http://code.google.com/p/google-guice/issues/detail?id=722

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.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to