1
主要异常信息 Error creating bean with name 'dataSource'
但是有个重要提示
dynamic-datasource Please check the setting of primary
解决方法:增加
<dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>4.3.1</version> </dependency>
2
java.lang.NullPointerException: Cannot invoke "com.tencent.wxcloudrun.dao.UserMapper.selectList(com.baomidou.mybatisplus.core.conditions.Wrapper)" because "this.userMapper" is null
如果你在单元测试中遇到这个错误,确保在测试类上使用了正确的注解来模拟Spring容器,如@RunWith(SpringRunner.class)
和@SpringBootTest
。
3
Correct the classpath of your application so that it contains a single, compatible version of org.ap
含有batis名字的类冲突,在pom.xml删除,clean
4.PaginationInnerInterceptor
无法引入PaginationInnerInterceptor
因为 jsqlparser 5.0+
版本不再支持 jdk8
针对这个问题解耦 jsqlparser
依赖。 正确打开姿势,引入 mybatis-plus-bom
模块,然后引入 ..starter
和 ..jsqlparser..
依赖
pom.xml中增加
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-bom</artifactId>
<version>3.5.9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-jsqlparser-4.9</artifactId>
</dependency>