日期:2014-05-17  浏览次数:21578 次

Injection of resource dependencies failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customBlackListService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.wondershare.router.dao.CustomBlackListDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}


找不到依赖的dao,什么原因,spring3 自动注解的,为什么找不到.代码如下
@Repository("customBlackListDao")
public class CustomBlackListDaoImpl extends GeneralDaoSupport<CustomBlackList> implements CustomBlackListDao {

--一下是service调用dao的代码
@Service("customBlackListService")
public class CustomBlackListServiceImpl implements CustomBlackListService{
@Resource
private CustomBlackListDao customBlackListDao;
spring exception

------解决方案--------------------
beans 的xml里面有没有 
<context:component-scan base-package="package-name"/>?