public void addSessionListeners(Collection<SessionListener> sessionListeners, SecurityManager sm) {
        sessionListeners.add(new SessionListener() {
            @Override
            public void onStart(Session session) {
                contexts.forEach(ctx -> ctx.onCreate(session));
            }

            @Override
            public void onStop(Session session) {
                contexts.forEach(ctx -> ctx.onDestroy(session));
            }

            @Override
            public void onExpiration(Session session) {
                onStop(session);
            }
        });
    }
intercept session destroy session listeners and destroy the beans

@param sessionListeners
@param sm
support/jakarta-ee/src/main/java/org/apache/shiro/ee/cdi/ShiroSessionScopeExtension.java