可以通过覆盖来实现 ConcurrentSessionControlStrategy.getMaximumSessionsForThisUser() 在自定义子类中。引用自 这是javadoc :
ConcurrentSessionControlStrategy.getMaximumSessionsForThisUser()
旨在由子类用于覆盖特定身份验证允许的最大会话数的方法。默认实现只返回bean的maximumSessions值。
然后通过以下方式引用自定义实现:
<security:session-management session-authentication-strategy-ref="customConcurrentSessionControlStrategy"/>