我一直收到一条消息:“org.springframework.beans.factory.NoSuchBeanDeFinitionException:没有定义名为’userDetailsService’的bean”,即使bean被定义为UserDetailsServiceImpl类中的服务.如:
@Service(value="userDetailsService")
public class UserDetailsServiceImpl implements UserDetailsService{
我正在使用最新的Spring和Spring Security.
我不确定我做错了什么.我正在粘贴我的spring xml文件的配置. spring-security.xml显示它在使用组件扫描时可以从servlet-context.xml中找到bean.
谢谢
org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.filterChains': Cannot resolve reference to bean org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [2]; 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.BeanCreationException: Error creating bean with name org.springframework.security.authenticationManager': Cannot resolve reference to bean org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDeFinitionException: No bean named 'userDetailsService' is defined
ecurity"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
sspath*:servlet-context.xml"/>
ecurity secured-annotations="enabled"> ecurity>
fig="true" >
原文地址:https://www.jb51.cc/spring/431638.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。