diff --git a/core/src/main/java/org/springframework/security/ui/rememberme/TokenBasedRememberMeServices.java b/core/src/main/java/org/springframework/security/ui/rememberme/TokenBasedRememberMeServices.java
index 1912568ae4..6e4c3ae283 100644
--- a/core/src/main/java/org/springframework/security/ui/rememberme/TokenBasedRememberMeServices.java
+++ b/core/src/main/java/org/springframework/security/ui/rememberme/TokenBasedRememberMeServices.java
@@ -135,28 +135,6 @@ public class TokenBasedRememberMeServices implements RememberMeServices, Initial
Assert.notNull(userDetailsService);
}
- /**
- * Introspects the Applicationcontext
for the single instance
- * of {@link AccessDeniedHandler}. If found invoke
- * setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler) method by
- * providing the found instance of accessDeniedHandler as a method
- * parameter. If more than one instance of AccessDeniedHandler
- * is found, the method throws IllegalStateException
.
- *
- * @param applicationContext to locate the instance
- */
- private void autoDetectAndUseAnyUserDetailsService(ApplicationContext applicationContext) {
- Map map = applicationContext.getBeansOfType(UserDetailsService.class);
- if (map.size() > 1) {
- throw new IllegalArgumentException(
- "More than one UserDetailsService beans detected please refer to the one using "
- + " [ principalRepositoryBeanRef ] attribute");
- }
- else if (map.size() == 1) {
- setUserDetailsService((UserDetailsService) map.values().iterator().next());
- }
- }
-
public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
Cookie[] cookies = request.getCookies();