Interesting. Session beans has its own @Predestroy , called when a session close event occurs. If the container never dispatches this event, then Spring will not be informed. I'm not sure if this is a bug or not, and if so, then this is a bug in Spring or Tomcat. The latter seems more likely, but I don't know if the Servlet container should do this.
If this is a show stopper for you, you may want to register a registered bean with a single "registrar" @PostConstruct during its @PostConstruct and unregister it with @Predestroy . If the logger is turned off, it can propagate this event to all beans remaining in the session that are still registered with it.
Not an ideal, but a pragmatic solution.
skaffman
source share