Spring IoC, WebFlow and scopes

Cantor, Scott cantor.2 at osu.edu
Tue Jun 25 12:44:12 EDT 2013


On 6/25/13 12:32 PM, "Brent Putman" <putmanb at georgetown.edu> wrote:
>
>No, the standard Spring (non-WebFlow) 'request' and 'session' scopes do
>support destruction callbacks.  I tested the request one, it got called
>when the request went out of scope.  From looking at the code, I think
>the session one would work the same way, although I couldn't devise any
>immediate easy way to test it.

So it's strictly the prototype scope and the new WebFlow scopes that
explicitly don't do this.

>It might be that, for this reason, we might want to use 'request' scope
>instead of 'prototype' for some of the per-use components (handlers,
>actions) since those generally are invoked once per servlet request
>anyway.  If they have non-trivial destruction code then at least they'd
>get called automatically.  I haven't yet actually seen any examples
>where this is critical though.

I think that's ok, but becomes a problem if we *depend* on that behavior
in the code, because then you need a servlet request/response to run the
actions. I was hoping to avoid that assumption at the level of the basic
behavior of the actions.

So certainly I was hoping we'd avoid the use of destructor callbacks in
general as a result. But the use of that DestroyableComponent interface
implies them.

-- Scott




More information about the dev mailing list