Open GoogleCodeExporter opened 9 years ago
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.
Original comment by sberlin
on 29 Oct 2010 at 11:48
Guice is creating the instance by calling the Provider method. I'd like a way
to listen for this happening. How can I do this?
Original comment by Randg...@gmail.com
on 29 Oct 2010 at 5:04
Original issue reported on code.google.com by
Randg...@gmail.com
on 28 Oct 2010 at 8:44Attachments: