1.项目中存在不兼容的 MyBatis-Plus 版本
会报一下错误:
The following method did not exist:
com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(Ljava/lang/CharSequence;)Z The calling method's class, com.baomidou.mybatisplus.autoconfigure.SafetyEncryptProcessor, was loaded from the following location: jar:file:/D:/maven/maven-repo/com/baomidou/mybatis-plus-boot-starter/3.4.3/mybatis-plus-boot-starter-3.4.3.jar!/com/baomidou/mybatisplus/autoconfigure/SafetyEncryptProcessor.class The called method's class, com.baomidou.mybatisplus.core.toolkit.StringUtils, is available from the following locations: jar:file:/D:/maven/maven-repo/com/baomidou/mybatis-plus-core/3.0.2/mybatis-plus-core-3.0.2.jar!/com/baomidou/mybatisplus/core/toolkit/StringUtils.class The called method's class hierarchy was loaded from the following locations: com.baomidou.mybatisplus.core.toolkit.StringUtils: file:/D:/maven/maven-repo/com/baomidou/mybatis-plus-core/3.0.2/mybatis-plus-core-3.0.2.jar Action: Correct the classpath of your application so that it contains compatible versions of the classes com.baomidou.mybatisplus.autoconfigure.SafetyEncryptProcessor and com.baomidou.mybatisplus.core.toolkit.StringUtils springboot
项目报错
解决方法:
-
升级 Spring Boot 版本:可以尝试升级 Spring Boot 版本到 MyBatis-Plus 兼容的版本,以便解决版本兼容性问题。
-
降级 MyBatis-Plus 版本:如果无法升级 Spring Boot 版本,则需要降级 MyBatis-Plus 版本,以便与 Spring Boot 兼容。可以通过修改 Maven 或 Gradle 依赖的方式降级 MyBatis-Plus 版本,具体操作如下:
-
Maven 依赖:在 pom.xml 文件中指定 MyBatis-Plus 的版本号即可,例如
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>3.2.0</version> </dependency>
-
Gradle 依赖:在 build.gradle 文件中指定 MyBatis-Plus 的版本号即可,例如
implementation 'com.baomidou:mybatis-plus:3.2.0'
。
-
2.在启动项目的时候,没有扫描到mapper包
解决方法:
2.在启动类使用@Mapperscan扫描mapper文件夹