title: Spring Session - SessionDestroyedEvent is not called
body: <p>I have a Spring application where sessions are stored in redis with a short timeout (1m). I want to call a function after my sessions timeout, however SessionDestroyedEvent @EventListener does not get called.</p>
  
  <p>SessionListener.java:</p>
  
  <pre><code>import org.springframework.context.event.EventListener;
  import org.springframework.session.events.SessionCreatedEvent;
  import org.springframework.session.events.SessionDestroyedEvent;
  import org.springframework.stereotype.Component;
  
  @Component
  public class SessionListener {
  
      @EventListener
      public void sessionCreated(SessionCreatedEvent event) {
          System.out.println("created"); // gets called
      }
  
      @EventListener
      public void sessionDestroyed(SessionDestroyedEvent event) {
          System.out.println("destroyed"); // never gets called
  
      }
  
  }
  </code></pre>
  
  <p>application.properties:</p>
  
  <pre><code>spring.session.store-type=redis
  server.servlet.session.timeout=1m
  </code></pre>
  
  <p>notes:</p>
  
  <ol>
  <li>eventListener on SessionCreatedEvent gets called</li>
  <li>sessions from redis disappear after the timeout</li>
  </ol>