Spring 3.5 Session Bean Lifecycle

2019-07-21 00:53发布

问题:

What triggers Spring's Session Bean to exist in the container, and what removes it? Basically, I want to understand the web flow's effect on Session Bean.

回答1:

Session bean is created when you try to access it from view for the first time or you want to access a bean that depends on it. It is stored in HTTP session so it is removed when session expires or is explicitly destroyed - this part is managed by a servlet container rather than spring.