SpirngBoot3.4与MyBatisplus 3.5.5 不兼容问题
在学习使用mybatis-plus时,出现了 项目搭建不起来。
报错信息为:
1
|
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'userMapper' defined in file [C:\javaweb\Template\target\classes\top\rose\template\mapper\UserMapper.class]: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
|
Invalid bean definition with name 'userMapper' defined in file
可以知道时bean管理出现问题了,但是我仅仅是最简单的 测试插入。 @Mapper @MapperScan 都尝试了,均没有用。
后了解到:Springboot 的版本和 Mybatis plus 中自带 mybatis 版本不兼容。
因此手动剔除自带版本,手动添加最新版本即可解决。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.5</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
|