Возможный дубликат:
Получение ошибки org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean с именем 'springSecurityFilterChain определено
В моем приложении Spring я продолжаю получать эту ошибку:
No bean named 'org.springframework.security.authenticationManager' is defined: Did you forget to add a gobal <authentication-manager> element to your configuration (with child <authentication-provider> elements)? Alternatively you can use the authentication-manager-ref attribute on your <http> and <global-method-security> elements.
В моем XML файле Spring Security context я определил следующее:
<beans:bean id="myUserDetailsService" class="com.myProject.core.security.MyUserDetailsService" />
<beans:bean id="encoder" class="com.myProject.core.security.HmacPasswordEncoder" />
<authentication-manager id="clientAuthenticationManager" >
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder ref="encoder" />
</authentication-provider>
</authentication-manager>
Любые идеи, почему он жалуется, когда я четко определил своего менеджера аутентификации и поставщика аутентификации?
Примечание: это может помочь, более описательная ошибка:
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.springframework.security.filterChains': Cannot resolve reference to bean
'org.springframework.security.web.DefaultSecurityFilterChain#2' while setting bean
property 'sourceList' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#2':
Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0'
while setting constructor argument with key [1]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0':
Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0'
while setting bean property 'authenticationManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve
reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0'
while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0':
FactoryBean threw exception on object creation; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named
'org.springframework.security.authenticationManager' is defined: Did you forget to
add a gobal <authentication-manager> element to your configuration (with child
<authentication-provider> elements)? Alternatively you can use the authentication-manager-ref
attribute on your <http> and <global-method-security> elements.