mybatis版本問(wèn)題
報(bào)錯(cuò)如下:
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.
使用的版本為2.2.2的時(shí)候,會(huì)報(bào)上面的錯(cuò)誤,使用3.0以后的版本正常
我的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>
2023-09-06
mybatis的版本與Spring Boot應(yīng)該匹配,不然報(bào)如下錯(cuò)誤:
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.