启动报错:Field xxxMapper in com.xxx.service.impl.xxxServiceImpl required a bean of type

 

困惑了一天的问题!!!

报错原因:

1.缺少@Mapper注解

2.pom包导入错误

3.检查一下mapper的包的层级不对!!!

导入以下包,不然@Autowired注解找不到mapper

        <!--Springboot+Mybatis整合(一定要导这个包不然Mapper找不到)-->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>

 

posted @ 2021-12-05 02:54  Sakimir  阅读(1514)  评论(0)    收藏  举报