Spring IoC, WebFlow and scopes

Brent Putman putmanb at georgetown.edu
Tue Jun 25 19:49:41 EDT 2013


On 6/25/13 12:44 PM, Cantor, Scott wrote:
> So it's strictly the prototype scope and the new WebFlow scopes that
> explicitly don't do this.

Yes, as far as I can tell.  At least of the scopes implemented by things
were currently considering using.  Other custom Spring scopes might be
implemented by other things.

>
>> 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.


Actually, turns out that neither the MessageHandler nor the Action impls
implement DestructableComponent at the moment anyway.  So problem
solved. :-)


> 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.


I haven't actually seen anything that's not a singleton that would have
destruction code.   So perhaps this is a non-problem (practically speaking).


>
> 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.

>From just doing an F4 on the interface in Eclipse it seems that less
stuff implements it than I would have thought. 


More information about the dev mailing list