使用spring data jpa时,自动注入dao层报错

来源:互联网 发布:c语言固定地址内存分配 编辑:程序博客网 时间:2024/06/05 13:44

报错内容:
org.springframework.beans.factory.BeanCreationException: Could not autowire field

NoSuchBeanDefinitionException: No qualifying bean of type [cn.dao.system.UserRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

解决:applicationContext.xml里面配置的spring data jpa 的包扫描,配置路径没有当前需要Autowired的dao层的继承了jpaRepository的接口

原创粉丝点击