今天新來的小伙子,進公司做項目,然后自己新建了包,出了以下錯誤
y.UnsatisfiedDependencyException: Error creating bean with name 'unMblTotController':
Unsatisfied dependency expressed through field 'dataService'; nested exception is org.springframework.beans.
factory.UnsatisfiedDependencyException: Error creating bean with name 'unMblTotServiceImpl': Unsatisfied dependency expressed
through field 'unMblTotMapper';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency
[com.yd.ydsetl.unmbl.mapper.UnMblTotMapper]: expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
錯誤的意識,controller,service,dao注入失敗,
那么可以說明是配置上的問題,跟代碼上沒有關系,
可以知道應該是包掃描上出現問題了,出現了命名的問題,
我們可以找到
spring-mvc.xml 或者spring.xml.還有spring-dao.xml文件去查看相關的包掃描,是否存在相關問題,
新來小哥,騙過了編譯器,但是在運行的時候出現這個錯誤,說明不是代碼,而是相關配置問題,