SpringBoot session初始化流程
2020-04-30 14:42:37 0 举报
spring session初始化流程
作者其他创作
大纲/内容
PatternTopic:__spring:session:event:0:created:*
SessionAutoConfiguration
添加了三个消息监听sessionDeletedChannelsessionExpiredChannelsessionCreatedChannelPrefix
不同颜色表示需要关注的级别
监听通道
监听
spring.session.store-type=redis
SessionRepositoryFilterConfiguration将过滤器注册到了spring中
SessionRepositoryFilterspringSessionRepositoryFilter()创建过滤器
CookieHttpSessionIdResolverinit()初始化session解析器
SessionRepositoryResponseWrapper
RedisSessionConfiguration
中:定时任务模块
ChannelTopic:一个确定的字符串PatternTopic:基于模式匹配
创建RedisTemplate
做了一系列条件检查
RedisMessageListenerContainerspringSessionRedisMessageListenerContainer()
@Conditional(ServletSessionCondition.class)
ChannelTopic:__keyevent@0__:del__keyevent@0__:expired
与SessionDestroyedEvent相关如果Redis没有设置redis-cli config set notify-keyspace-events Egx那么将不会生效
InitializingBeanenableRedisKeyspaceNotificationsInitializer()
中:消息通知模块
对sessionCreatedChannelPrefixsessionDeletedChannelsessionExpiredChannel进行了赋值
SpringBootRedisHttpSessionConfiguration
高:核心模块
SessionRepositoryRequestWrapper
configureRedisAction()ConfigureRedisAction
RedisSessionExpirationPolicy
监听spring事件对象:SessionDestroyedEventSessionCreatedEvent
SessionCleanupConfiguration配置定时任务
创建了EnableRedisKeyspaceNotificationsInitializer在afterPropertiesSet方法中,调用了ConfigureNotifyKeyspaceEventsAction的configure方法
RedisIndexedSessionRepositorysessionRepository()
SpringHttpSessionConfiguration
SessionEventHttpSessionListenerAdapter注册事件监听
RedisHttpSessionConfiguration
RedisIndexedSessionRepository
0 条评论
下一页