title: Spring Security Java Config - custom AuthenticationProvider and UserDetailsService
body: <p>I use java configuration to configure Spring Security, and I have customized AuthenticationProvider and customized UserDetailsService, to add extra login field following 
  <a href="http://forum.spring.io/forum/spring-projects/security/95715-extra-login-fields">http://forum.spring.io/forum/spring-projects/security/95715-extra-login-fields</a></p>
  
  <p>I have difficulty to add both of the customized Classes into Spring Security framework by using java configuration.
  As java doc of AuthenticationProvider#authenticationProvider describes:</p>
  
  <blockquote>
    <p>Add authentication based upon the custom AuthenticationProvider that
    is passed in. Since the AuthenticationProvider implementation is
    unknown, all customizations must be done externally and the
    AuthenticationManagerBuilder is returned immediately.</p>
    
    <p>This method does NOT ensure that the UserDetailsService is available
    for the getDefaultUserDetailsService() method.</p>
  </blockquote>
  
  <p>So my question is what is the approach to set UserDetailsService in this case?</p>