title: Spring security custom filter initialization
body: <p>I am getting this error when i add filter-chain-proxy bean. I think I must create a bean with named securityContextPersistenceFilterWithASCTrue but there is no such a bean shown at examples. Is there any solution?</p>
  
  <pre><code>SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
  'filterChainProxy' defined in ServletContext resource [/WEB-INF/spring-security.xml]:     Cannot resolve reference to bean 'securityContextPersistenceFilterWithASCTrue' while     setting bean property 'filterChainMap' with key [Root bean: class     [org.springframework.security.web.util.AnyRequestMatcher]; scope=; abstract=false;     lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false;        factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]     with key [0]; nested exception is     org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named      'securityContextPersistenceFilterWithASCTrue' is defined
  </code></pre>
  
  <p>here is my Spring-config;</p>
  
  <pre><code>&lt;beans:beans xmlns="http://www.springframework.org/schema/security"
           xmlns:beans="http://www.springframework.org/schema/beans" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  http://www.springframework.org/schema/security
  http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt;
  
  
  
  &lt;http auto-config='true' use-expressions="true"&gt;
      &lt;intercept-url pattern="/login" access="permitAll"/&gt;
      &lt;intercept-url pattern="/ajaxErrorPage" access="permitAll"/&gt;
      &lt;intercept-url pattern="/pages/*" access="hasRole('admin')" /&gt;
      &lt;intercept-url pattern="/j_spring_security_check" access="permitAll"/&gt;        
      &lt;logout logout-success-url="/login.xhtml" /&gt;
      &lt;form-login login-page="/login.xhtml"
                  login-processing-url="/j_spring_security_check"                                                       
                  default-target-url="/pages/index.xhtml"
                  always-use-default-target="true"                                                        
                  authentication-failure-url="/login.xhtml"/&gt;
  &lt;/http&gt;
  
  
  &lt;!--Authentication Manager Details --&gt;    
  &lt;authentication-manager alias="authenticationManager"&gt;
      &lt;authentication-provider user-service-ref="customUserDetailsService"&gt;
          &lt;!--            &lt;password-encoder hash="md5"/&gt;--&gt;
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  
  
  &lt;beans:bean id="filterChainProxy" 
    class="org.springframework.security.web.FilterChainProxy"&gt;
  &lt;filter-chain-map&gt;     
   &lt;filter-chain pattern="/**" filters="
         securityContextPersistenceFilterWithASCTrue,
         formLoginFilter,
         exceptionTranslationFilter,
         filterSecurityInterceptor,
         customAjaxControlFilter" /&gt;
  &lt;/filter-chain-map&gt;
  &lt;/beans:bean&gt;
  
  
  &lt;/beans:beans&gt;
  </code></pre>