我實現春季安全在我的項目無法識別的Spring Security認證提供商的用戶服務,裁判
在我的DAO類我定義的loadUserByUsername
我的課就像
UserDAOImpl.java
@Repository
public class UserDAOImpl {
public UserDetails loadUserByUsername(String name)throws UsernameNotFoundException
{
//implementation
}
}
在Spring-security.xml文件
<authentication-manager>
<authentication-provider user-service-ref="UserDAOImpl">
</authentication-provider>
</authentication-manager>
但是當我跑我得到一個錯誤的程序
Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'UserDAOImpl' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'UserDAOImpl' is defined
誰能幫助我我怎麼解決這個問題?
您是否在servlet-context.xml中定義了您的UserDaoImpl bean? –
將不會框架自動檢測它我已經給@Repository UserDaoImpl? – underdog
它會,但你添加了''? –
AKS