In this case, inject a Provider of what you need, and call get() when you
need it.  This requires that you call get() only when you're in scope, which
by the problem definition you should be, otherwise you would't need a scoped
object.

-Fred

On Sun, Oct 24, 2010 at 10:59 PM, Max <[email protected]> wrote:

> I suppose constructor injection implies injected beans have a longer
> lifecycle than the newly created bean.
>
> For instance:
>
> http://code.google.com/p/google-guice/wiki/ServletModule#Available_Injections
>
> My question is, is it possible to inject a bean with a shorter
> lifecycle, like inject a session scoped bean to a singleton?
>
> Here is my scenario, I would like to use JPA @preupdate to
> automatically update updDt / updUser. That means a singleton listener
> is referencing to a session scoped variable. Any idea?
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" 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?hl=en.

Reply via email to