config/src/main/java/org/springframework/security/config/annotation/authentication/builders/AuthenticationManagerBuilder.java
public <T extends UserDetailsService> DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T> userDetailsService(
			T userDetailsService) throws Exception {
		this.defaultUserDetailsService = userDetailsService;
		return apply(new DaoAuthenticationConfigurer<>(
				userDetailsService));
	}
public <T extends UserDetailsService> DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T> userDetailsService(
			T userDetailsService) throws Exception {
		this.defaultUserDetailsService = userDetailsService;
		return apply(new DaoAuthenticationConfigurer<>(
				userDetailsService));
	}
Add authentication based upon the custom {@link UserDetailsService} that is passed
in. It then returns a {@link DaoAuthenticationConfigurer} to allow customization of
the authentication.

<p>
This method also ensure that the {@link UserDetailsService} is available for the
{@link #getDefaultUserDetailsService()} method. Note that additional
{@link UserDetailsService}'s may override this {@link UserDetailsService} as the
default.
</p>

@return a {@link DaoAuthenticationConfigurer} to allow customization of the DAO
authentication
@throws Exception if an error occurs when adding the {@link UserDetailsService}
based authentication