许多 "empty" 个会话为 NULL princial_name

Many "empty" sessions with NULL princial_name

我使用 spring-session-jdbc 和 spring-security。此时我已经记录了 20 个用户(具有正确的会话 ID 和 principal_name)和大约 11k 行具有会话 ID 和空 principal_name。这是正常行为吗?我的设置:

security.sessions=(默认)

@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 86400)

数据库中有大量会话记录本身并没有任何异常,特别是因为您已经验证过期会话的清理工作正常。

您已经配置了相当大的 maxInactiveIntervalInSeconds 86400 秒(1 天),因此拥有该数量的匿名会话(即未经身份验证的会话或没有 [=11= 的会话记录)并非不合理] set) 在一天的时间内发起。