posted 13 years ago
Not beans themselves, no. A bean is something that can (in theory) be a member of more than one collection, although obviously putting a bean in both the session and request collections is a little silly. What you can do, however, is set up a listener to the collection itself. For example, when the session is destroyed, a session listener is a clue that all the beans in the session are going out of scope, since the scope itself is being destroyed. Beans don't just evaporate, so that's usually sufficient unless you have code that's manually inserting/removing beans.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.