【已解决】Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String 报错解决
mybatis-spring 官方项目中使用 mybatis-plus-boot-starter 当前最新版本 3.5.4.1 ,其中依赖的 mybatis-spring 版本为 2.1.1。此时因为 factoryBeanObjectType 是 String 类型,不符合条件而抛出异常。更新本地的Mybatis plus版本。
一、问题描述
Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String
二、解决方案
更新本地的Mybatis plus版本
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.5</version>
</dependency>
三、分析原因
mybatis-spring 官方项目中使用 mybatis-plus-boot-starter 当前最新版本 3.5.4.1 ,其中依赖的 mybatis-spring 版本为 2.1.1。在 mybatis-spring 2.1.1 版本的 ClassPathMapperScanner#processBeanDefinitions 方法里将 BeanClassName 赋值给 String 变量并将 beanClassName 赋值给 factoryBeanObjectType,但是在 Spring Boot 3.2 版本中FactoryBeanRegistrySupport#getTypeForFactoryBeanFromAttributes方法已变更,如果 factoryBeanObjectType 不是 ResolvableType 或 Class 类型会抛出 IllegalArgumentException 异常。此时因为 factoryBeanObjectType 是 String 类型,不符合条件而抛出异常。
更多推荐
所有评论(0)