错误信息日志:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'customerServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.bwf.dao.CustomerDao com.bwf.service.impl.CustomerServiceImpl.customerDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.bwf.dao.CustomerDao] 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)}
我的maven-dao的pom.xml
我的service实现类
我的application配置文件
后来才发现,原来是mapper交给spring容器去管理,导致了框架找不到对应的对象,加一个注解就好了。
转载于:https://my.oschina.net/u/3680585/blog/1544410