title: How to create listener for spring session destroyed events?
body: <p>I have a code as below:</p>
  
  <pre><code>@Component
  public class LogoutListener implements ApplicationListener&lt;SessionDestroyedEvent&gt;
  {
    @Override
    public void onApplicationEvent(SessionDestroyedEvent event)
    {
      System.out.println("Application event happened");
      for (SecurityContext securityContext : event.getSecurityContexts())
      {
          System.out.println("session has ended");   
      }
    }
  }
  </code></pre>
  
  <p>Since I am using a spring boot app.I cant use web.xml.Then how can I configure the listener.
  This listener is looking for session destroyed events.</p>