当 Shiro 与 Spring 和 web 过滤器一起使用时,如何添加 Shiro SessionListener?

How to add Shiro SessionListener when Shiro is used with Spring and web filter?

我想将会话侦听器 (org.apache.shiro.session.SessionListener) 添加到 SessionManager。正如我在使用 shiro web 时发现的那样,默认情况下 SessionManager 的实现是 ServletContainerSessionManager。但是,我没有在 ServletContainerSessionManager 中找到任何添加监听器的方法。谁能告诉我如何添加这个监听器?

ServletContainerSessionManager 只是您的 Servlet 容器提供的会话管理的包装器。如果你想使用 Shiro 的 SessionListner,你需要使用不同的 SessionManager 实现,例如 DefaultWebSessionManager