Comment #99 on issue 62 by [email protected]: Lifecycle support
http://code.google.com/p/google-guice/issues/detail?id=62
Quick question: Have Guice gotten intelligent about the order in which it
instantiates objects?
Earlier, it just did one or the other random order, not caring about each
instance dependencies, creating those annoying proxies when it got to any
dependency it didn't already have available.
Then one got the option of specifying that proxies should not be used.
However, the order hadn't gotten any smarter, so one still could
arbitrarily crash into the ordering-problem, only now it stops with
exception, not creating the proxy.
This even though a simple reordering of the flow would have fixed it.
First create the leafs; the ones without dependencies. Then work your way
up: Create instances whose dependencies at this point be fulfilled. If you
at some point iterate through the entire list of "to be instantiated" w/o
instantiating any, then you have a dependency-loop.
Loops are only evaluated by constructors. Fields and methods can always be
injected afterwards.
.. which leads to my point #1 about stuff like @PostConstruct..
--
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.