赞
踩
升级Springboot到3.2之后启动项目出现如下错误:
java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
报错截图:
由于项目中引入了mybatis-plus3.5.4.1,其中依赖的mybatis-spring版本为2.1.1
mybatis-spring2.1.1版本的ClassPathMapperScanner#processBeanDefinitions 方法里将 BeanClassName 赋值给 String 变量
并将beanClassName赋值给factoryBeanObjectType
在Springboot3.2版本中FactoryBeanRegistrySupport.getTypeForFactoryBeanFromAttributes方法已经修改,如果factoryBeanObjectType不是ResolvableType或Class类型会抛出IllegalArgumentException已存。此时factoryBeanObjectType是String类型,所以抛出异常。
解决方法:
引入mybatis-plus3.5.5版本
注意是mybatis-plus-spring-boot3-starter
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.5</version>
</dependency>
重新启动解决这个问题。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。