@Mapper注解无效造成XXX required a bean of type XXX that could not be found

前几天照着网上的视频写代码发现的这个错误,一开始按照网上的帖子加了@MapperScan但是并没有什么卵用

后来发现是Maven依赖的问题,按照idea推荐的来@Mapper虽然不会爆红但是运行时就会找不到文件
正确的依赖是,version用自己下载的版本就好。

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.4</version>
        </dependency>
posted @ 2022-07-15 20:40  颜骏  阅读(939)  评论(0编辑  收藏  举报