the method initSessionCookie should not be called in expireSession!!!

as this will reset the expire state:

if (this.cookieInitializer != null) {
            this.cookieInitializer.accept(cookieBuilder);
        }

Comment From: sbrannen

expireSession() invokes initSessionCookie() with Duration.ZERO for maxAge, and the documentation for ResponseCookie.ResponseCookieBuilder.maxAge(Duration) states the following:

A value of 0 means the cookie should expire immediately.

In light of that, I am closing this issue.

However, if you think you have discovered a bug, please provide a failing test that demonstrates the bug.