I am trying to implement below, but my authenticationManager instance throws an exception below and is not auto-sensing. How can I get its instance from Spring manually? I do not use a Spring controller, I use a JSF request with a bean binding. At runtime, I get the following exception when the container tries autwire authenticationManager. RequestCache is delivered in order. I donβt understand why I have two instances ...
configurations:
<authentication-manager> <authentication-provider user-service-ref="userManager"> <password-encoder ref="passwordEncoder" /> </authentication-provider> </authentication-manager>
Failed to inject auto-notified dependencies; The nested exception is org.springframework.beans.factory.BeanCreationException: Autofield failed: protected org.springframework.security.authentication.AuthenticationManager com.dc.web.actions.SignUpDetail.authenticationManager; The nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: a unique bean of type [org.springframework.security.authentication.AuthenticationManager] is not defined: expected one-time bean match, but found 2: [org.springframework.security.authentication. 0, org.springframework.security.authenticationManager] javax.faces.webapp.FacesServlet.service (FacesServlet.java:325)
@Controller public class SignupController { @Autowired RequestCache requestCache; @Autowired protected AuthenticationManager authenticationManager; @RequestMapping(value = "/account/signup/", method = RequestMethod.POST) public String createNewUser(@ModelAttribute("user") User user, BindingResult result, HttpServletRequest request, HttpServletResponse response) {
c12
source share