org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘userDaoImpl‘: Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.dao.UserMapper com.service.UserDaoImpl.userMapper;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dao.UserMapper] 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)}
原因,在spring的配置文件中扫不到mapper下的dao文件们,可能就是路径写错了。
我的原因是:路径多了一个classpath:
所以把classpath去掉就好了。
时间: 2024-10-25 20:26:32