title: Unable to call LogoutSuccessHandler - Spring Security
body: <p>I am trying to implement a <strong>Custom</strong> Spring Security Logout Handler. My configurations are as below but the logout handler is never called.</p>
  
  <p>I have a JSP where I call logout as : </p>
  
  <pre><code>&lt;a href="j_spring_security_logout"&gt;Logout&lt;/a&gt;
  </code></pre>
  
  <p>In the application-security.xml, I have the following:</p>
  
  <pre><code>    &lt;security:logout  invalidate-session="true"&gt;&lt;/security:logout&gt;
      &lt;security:logout logout-url="/logout" success-handler-ref="myCustomLogoutSuccessHandler"&gt;&lt;/security:logout&gt;  
  
  
  &lt;beans:bean id="myCustomLogoutSuccessHandler"  class="com.inventory.security.MyCustomLogoutSuccessHandler"&gt;&lt;/beans:bean&gt;
  </code></pre>
  
  <p>I have a Custom Logout handler too with the defination:</p>
  
  <pre><code>public class MyCustomLogoutSuccessHandler extends
  SimpleUrlLogoutSuccessHandler implements LogoutSuccessHandler {
  
       @Override
          public void onLogoutSuccess
            (HttpServletRequest request, HttpServletResponse response, Authentication authentication) 
            throws IOException, ServletException {
           System.out.println("Principal: "+authentication.getPrincipal());
           System.out.println("Logout Called: MyCustomLogoutSuccessHandler");
  
              super.onLogoutSuccess(request, response, authentication);
          }
  }
  </code></pre>
  
  <p>But this is never been called. Am I missing something?</p>
  
  <p>If I change the j_spring_security_logout to logout and create my custom Controller for that URL , then in that case the code works for logout URL but how do I handle the Spring <strong>Magic</strong> Logout </p>