No unique bean of type [] is defined:

      Click here to attend Spring Framework 4.x and certification course with a discount

If you get the following exception while injecting AuthenticationManager object inside services/controller classes using Spring Framework.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [] is defined: expected single matching bean but found 3: [,,]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement

… 39 more

You should add the Qualifier Annotation for the bean AutoWired;

public void setAuthenticationManager(AuthenticationManager autm) {
authenticationManager = autm;

I assume you declared alias for the AuthenticationManager object such as
<authentication-manager alias=”authenticationManager“>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s