Bitte, warum habe ich diesen Fehler, wenn ich meine Anwendung ausführenorg.springframework.beans.factory.BeanCreationException: Fehler Bohne Erstellung mit dem Namen ‚securityServiceImpl‘:
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityServiceImpl': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.authentication.AuthenticationManager com.springfoundation.service.SecurityServiceImpl.authenticationManager;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No unique bean of type [org.springframework.security.authentication.AuthenticationManager] is defined:
expected single matching bean but found 3:
[org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,
org.springframework.security.authentication.ProviderManager#0,
org.springframework.security.authenticationManager]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
Dies ist der zweite Stacktrace
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.authentication.AuthenticationManager com.springfoundation.service.SecurityServiceImpl.authenticationManager;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No unique bean of type [org.springframework.security.authentication.AuthenticationManager] is defined:
expected single matching bean but found 3:
[org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,
org.springframework.security.authentication.ProviderManager#0,
org.springframework.security.authenticationManager]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:513)
Was ist los?
Irgendwie haben Sie sich registriert ** Three ** 'AuthenticationManager's. Veröffentlichen Sie weitere Details zu Ihren Konfigurationen. –
Könnten Sie bitte etwas von Ihrem Code posten? Wie sieht Ihre Datei spring-servlet.xml aus? – Lexi
@AliDehghani Welchen Abschnitt des Codes suchen Sie? – Blaze