当前位置:   article > 正文

SpringBoot3.2 Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String_invalid value type for attribute 'factorybeanobjec

invalid value type for attribute 'factorybeanobjecttype': java.lang.string

升级Springboot到3.2之后启动项目出现如下错误:

java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
  • 1

报错截图:
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/6bdfb2655cfd45b6a7be7abfd260f857.pn
由于项目中引入了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>
  • 1
  • 2
  • 3
  • 4
  • 5

重新启动解决这个问题。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/1018775
推荐阅读
相关标签
  

闽ICP备14008679号