Logout is not working in Spring Security
<p>I am writing a security application with Spring Security 4.0. As part of that I want to make a logout call. It is simply giving Request method 'POST' not supported. Here is my code:</p>

<p><strong>spring-security.xml</strong></p>

<pre class="lang-xml prettyprint-override"><code>&lt;security:http  auto-config="true"&gt;
    &lt;security:access-denied-handler error-page="/denied"/&gt;
        &lt;security:form-login login-page="/login"
        username-parameter="j_username"
        password-parameter="j_password"
        login-processing-url="/j_spring_security_check"
        authentication-failure-url="/login?failed=true" 
        default-target-url="/home" always-use-default-target="true"/&gt;
        &lt;security:custom-filter ref="secfilter" before="FILTER_SECURITY_INTERCEPTOR" /&gt;

        &lt;security:logout invalidate-session="true" logout-url="/j_spring_security_logout" logout-success-url="/login"/&gt;
        &lt;!-- &lt;security:logout  logout-url="/j_spring_security_logout" logout-success-url="/login"/&gt; --&gt;

    &lt;security:csrf /&gt; 
&lt;/security:http&gt;
</code></pre>

<p><strong>jsp</strong></p>

<pre><code>&lt;a href="j_spring_security_logout"&gt;  &lt;button class="logoutbtn"&gt;logout&lt;/button&gt;&lt;/a&gt;
&lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/&gt;
</code></pre>