in objects that are stored in servletcontext scope it is not a good
idea to keep references to class objects directly as it may lead to
the container not being able to release the classloaders and shutdown
cleanly when the context is shutdown. we usually keep a weak reference
and a name, so when weakreference is unavailable we look up the class
by name, weakref is just a cache.

as far as @springbean, those create special proxies just so you do not
serialize the entire container.

-igor



On Thu, Nov 18, 2010 at 11:44 AM, alex shubert <[email protected]> wrote:
> Hello!
>
> I got a question about that often WeakReference usage in Wicket code.
>
> For example, private WeakReference<Class<? extends Page>>
> accessDeniedPage; in Settings.
> So my question is: why did author used WeakReference here? Isn't it
> somehow unsafe as that reference to accessDeniedPage may be just GC-ed
> somewhere during container work?
>
> And second part. I found a caution about not using strong reference to
> injected Spring beans for the danger of serialization of a whole
> Spring container. Ok, but what about @SpringBean? Is that works
> somehow different and uses some sort of Detachable model already?
>
> P.S.: forgive my strange English pls, it is not my native language.
> P.S.S. I would highly appreciate if someone with strong English
> correct my mistakes in private letter :)
>
> Thank you for reading all of this!
>
> --
> best regards
> Alex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to