Updates:
        Status: Invalid

Comment #1 on issue 565 by sberlin: InjectionListener.afterInjection() not called for instances created via Providers
http://code.google.com/p/google-guice/issues/detail?id=565

The reason you're not being notified of injection is because Foo isn't being injected. The provider is manually constructing it and returning it, and no @Inject fields in it are injected. You can verify this by adding an @Inject String data within Foo and printing it out, it will print out 'null' for data.

But.. if you inject a MembersInjector<Foo> into your @Provides method, and call membersInjector.injectMembers(foo) before returning it, then it *will* be injected (it will print out a blank string for data instead of null), and afterInjection *will* be notified.

So, if there's any bug here, it would be that instances returned by provider methods aren't injected... but I'm not exactly sure that's a bug.

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

Reply via email to