title: Referenced Bean not found
body: <p>I am new to Spring and am using Spring 3.2.5 RELEASE. I have a custom UserDetailsSevice called MongoUserDetailsService. This is my application-security.xml.</p>
  
  <pre><code>&lt;http auto-config="true"&gt;
    &lt;intercept-url pattern="/secured/*" access="ROLE_USER" /&gt;
      &lt;form-login login-processing-url="/login" login-page="/loginPage"
          username-parameter="username" password-parameter="password"
          default-target-url="/secured/mypage" authentication-failure-url="/loginPage?auth=fail" /&gt;
      &lt;logout logout-url="/logout" logout-success-url="/logoutPage" /&gt;        
  &lt;/http&gt;
  
  &lt;authentication-manager alias="authenticationManager"&gt;
      &lt;authentication-provider user-service-ref="mongoUserDetailsService"&gt;
          &lt;password-encoder hash="plaintext" /&gt;
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  </code></pre>
  
  <p></p>
  
  <p>and here is my dispatcher-servlet.xml</p>
  
  <pre><code>&lt;context:component-scan base-package="com.srccodes.spring.controller" /&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/pages/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mongoUserDetailsService" class="com.srccodes.spring.security.MongoUserDetailsService"&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>I receive a bean not found error in application-security.xml  where the authentication-provider is provided. I have checked the paths and they are correct.</p>
  
  <p>I am adding my web.xml as well.</p>
  
  <pre><code>    &lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;!-- Spring context files to be loaded --&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/applicationContext.xml,
          /WEB-INF/application-security.xml,
          /WEB-INF/mongo-config.xml
      &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;!-- filter declaration for Spring Security --&gt;
  &lt;filter&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
    &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>