亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

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
提交
取消

mybatis版本問題

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號