mybatis整合ss的時候,無法autowire使用mapper的自動注入,找不到bean:NoSuchBeanDefinitionException


  
  
  
          
  1. org.springframework.beans.factory.BeanCreationException:
  2. Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed;
  3. nested exception is org.springframework.beans.factory.BeanCreationException:
  4. Could not autowire field: private com.dao.UserMapper com.service.UserDaoImpl.userMapper;
  5. 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去掉就好了。





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM