spring-projects / spring-session

Spring Session
https://spring.io/projects/spring-session
Apache License 2.0
1.86k stars 1.12k forks source link

A question about the event mechanism in SpringSession #1287

Closed glmapper closed 5 years ago

glmapper commented 5 years ago

I have a doubt when I am learning the SpringSession source code. In the RedisOperationsSessionRepository class, when trying to publish an event, such as SessionCreatedEvent, the publishEvent in eventPublisher is a null operation.

private ApplicationEventPublisher eventPublisher = new ApplicationEventPublisher() {
   @Override
   public void publishEvent(ApplicationEvent event) {
   }

   @Override
   public void publishEvent(Object event) {
   }
};
rwinch commented 5 years ago

@gaborcs Thank you for using Spring Session and for your question!

This is the default eventPublisher. A custom implementation is typically injected in via RedisOperationsSessionRepository.setApplicationEventPublisher

I'm closing this as answered. In the future please post questions to StackOverflow as this is our preferred mechanism for questions.