title: how to perform operation just before logout in spring?
body: <p>First of all this is not a duplicate question i checked answers <a href="https://stackoverflow.com/questions/3112972/spring-security-customize-logout-handler">here</a>! and
  <a href="https://stackoverflow.com/questions/16940017/spring-custom-logout-filter-to-perform-some-action-before-logs-out">here</a>! but couldnt get it to work.</p>
  
  <p>Also i want to perform it just before logout so can not use logoutSuccessHandler.</p>
  
  <p>So i need to create a custom LOGOUT_FILTER , with which i am really having hard time getting it to work.</p>
  
  <p>here is my spring-security xml in which i tried two methods
  first was :-</p>
  
  <pre><code> &lt;custom-filter ref="logoutFilter" position="LOGOUT_FILTER" /&gt;
  
  &lt;beans:bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"&gt;
  &lt;beans:constructor-arg index="0" value="/logoutSuccess" /&gt;
  &lt;beans:constructor-arg index="1"&gt;
      &lt;beans:list&gt;
          &lt;beans:bean id="securityContextLogoutHandler"
          class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /&gt;
      &lt;beans:bean id="myLogoutHandler" class="com.fe.cms.listener.SimpleLogoutHandler" /&gt;
      &lt;/beans:list&gt;
  &lt;/beans:constructor-arg&gt;
  &lt;beans:property name="filterProcessesUrl" value="/logout" /&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>but this gives me error</p>
  
  <pre><code>Configuration problem: Security namespace does not support decoration of element [custom-filter] 
  </code></pre>
  
  <p>then i tried..</p>
  
  <pre><code>&lt;beans:bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"&gt;
      &lt;beans:constructor-arg index="0" value="/logout" /&gt;
      &lt;beans:constructor-arg index="1"&gt;
          &lt;beans:ref bean="securityContextLogoutHandler" /&gt;
          &lt;beans:ref bean="myLogoutHandler" /&gt;
      &lt;/beans:constructor-arg&gt;
      &lt;beans:property name="filterProcessesUrl" value="/logout" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean id="securityContextLogoutHandler"
      class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /&gt;
  
  &lt;beans:bean id="myLogoutHandler" class="com.fe.cms.listener.SimpleLogoutHandler" /&gt;
  
  &lt;http auto-config="false" entry-point-ref="authenticationManger"&gt;
      &lt;custom-filter ref="logoutFilter" position="LOGOUT_FILTER" /&gt;
  &lt;/http&gt;
  </code></pre>
  
  <p>but this gives me error :- </p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#48' while setting bean property 'sourceList' with key [48]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#48': Cannot create inner bean '(inner bean)' of type [org.springframework.security.web.access.ExceptionTranslationFilter] while setting constructor argument with key [6]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#181': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
  </code></pre>
  
  <p>Please can anyone tell where am i doing wrong ..
  i will post full xml files if needed</p>