问答详情
源自:2-4 Mybatis自动生成器使用方式

dao层bean注入失败

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'app':

Unsatisfied dependency expressed through field 'userDOMapper': No qualifying bean of type [com.cut.dao.UserDOMapper] found for dependency [com.cut.dao.UserDOMapper]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.cut.dao.UserDOMapper] found for dependency [com.cut.dao.UserDOMapper]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

https://img1.mukewang.com/5cced05f0001e4f710650469.jpg

https://img1.mukewang.com/5cced05f0001c0b812930493.jpg

https://img4.mukewang.com/5cced1170001765611530372.jpg

求大神解救一下,一直报这个错误,开始我完全照老师的代码,报这个错误,后来我把接口类加上Component注解或者Repository注解反正能换的我都试过了,完全报同样的错误,检查了各个配置的路径也没有错误,代码不报错,编译报错。不知道问题出在哪,怎么解决??

提问者:qq_怎么就迟了_0 2019-05-05 20:08

个回答

  • SirHumphrey
    2019-09-03 10:57:31

    把所有接口上的注解改成@Mapper问题解决

  • big_padan
    2019-08-23 15:19:25

    你这个问题解决了吗?

  • 慕工程0164977
    2019-05-28 11:03:27

    https://img1.mukewang.com/5ceca4f000016a7609800599.jpg看看是这个问吗

  • qq_三荤两素_04103474
    2019-05-27 21:47:23

    @Resource代替@autowried


  • leetHuam
    2019-05-08 10:57:47

    这个好像是生成的UserDOMapper.xml和UserPasswordDOMapper.xml文件中重复生成了resultMap,然后删掉重复的就好了,希望有帮助

  • 慕粉3169703
    2019-05-07 14:35:03

    对userDoMapper变量进行setter方式注入,试试