Comment #106 on issue 62 by [email protected]: Lifecycle support
http://code.google.com/p/google-guice/issues/detail?id=62
Using a marker interface or annotations makes no great difference to me.
I think that the reason why people (including me) request this feature is
because it provides a simple machinery to forward the "scope begin"
/ "scope end" events to objects in that scope without requiring any
dependency among who starts/stops the scopes and the object living there.
Following this view, I think that it would make sense to generalize the
eagerness attribute to each scope: instead of
bind(X).to(Y).asEagerSingleton(), one could use something like
bind(X).toY().eager().in(Singleton.class). In this way one could perform
some initialization phase at (session / request / whatever ) start time.
I think that this extension would also make less arbitrary the choice of
which objects Guice should starts and stop. The user could force an object
to be initialized (and destroyed) by Guice at scope beginning (end) simply
by binding it eagerly in that scope.
--
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.