spring-framework / org.springframework.web.server.session / InMemoryWebSessionStore / setClock

setClock

open fun setClock(clock: Clock): Unit

Configure the Clock to use to set lastAccessTime on every created session and to calculate if it is expired.

This may be useful to align to different timezone or to set the clock back in a test, e.g. Clock.offset(clock, Duration.ofMinutes(-31)) in order to simulate session expiration.

By default this is Clock.system(ZoneId.of("GMT")).

Parameters

clock - the clock to use