为了账号安全,请及时绑定邮箱和手机立即绑定

mybatis版本问题

报错如下:

Description:


A component required a bean of type 'com.xiaogai.allone.mapper.TagMapper' that could not be found.



Action:


Consider defining a bean of type 'com.xiaogai.allone.mapper.TagMapper' in your configuration.


https://img1.sycdn.imooc.com//64f751a100011afd22670572.jpg


使用的版本为2.2.2的时候,会报上面的错误,使用3.0以后的版本正常


https://img1.sycdn.imooc.com//64f751fc000177af18800347.jpg


我的pom文件:


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-parent</artifactId>
       <version>3.0.10</version>
       <relativePath/> <!-- lookup parent from repository -->
   </parent>
   <groupId>com.xiaogai</groupId>
   <artifactId>allone</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>base-learn-v1</name>
   <description>base-learn-v1</description>
   <properties>
       <java.version>17</java.version>
   </properties>
   <dependencies>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-thymeleaf</artifactId>
       </dependency>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-web</artifactId>
       </dependency>

       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-test</artifactId>
           <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>org.projectlombok</groupId>
           <artifactId>lombok</artifactId>
           <optional>true</optional>
       </dependency>
       <dependency>
           <groupId>org.mybatis.spring.boot</groupId>
           <artifactId>mybatis-spring-boot-starter</artifactId>
<!--            <version>2.2.2</version>-->
           <version>3.0.2</version>
       </dependency>
       <dependency>
           <groupId>mysql</groupId>
           <artifactId>mysql-connector-java</artifactId>
           <version>8.0.29</version>
       </dependency>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-thymeleaf</artifactId>
       </dependency>
       <dependency>
           <groupId>org.webjars</groupId>
           <artifactId>webjars-locator</artifactId>
           <version>0.45</version>
       </dependency>
       <dependency>
           <groupId>org.webjars</groupId>
           <artifactId>jquery</artifactId>
           <version>3.5.1</version>
       </dependency>
       <dependency>
           <groupId>org.webjars</groupId>
           <artifactId>layui</artifactId>
           <version>2.5.7</version>
       </dependency>
   </dependencies>

   <build>
       <plugins>
           <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
           </plugin>
       </plugins>
   </build>

</project>


正在回答

1 回答

mybatis的版本与Spring Boot应该匹配,不然报如下错误:



Description:


A component required a bean of type 'com.xiaogai.allone.mapper.TagMapper' that could not be found.



Action:


Consider defining a bean of type 'com.xiaogai.allone.mapper.TagMapper' in your configuration.




https://img1.sycdn.imooc.com//64f75254000186d817370347.jpg


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Spring Boot3.0最新版入门与商品特征打标实战
  • 参与学习       3170    人
  • 解答问题       9    个

Spring Boot3.0最新版入门与商品特征打标实战

进入课程

mybatis版本问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信