让AI帮我写个SpringBoot+MybatisPlus的程序,启动报错。
java.lang.IllegalArgumentException:
Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
上网查了一下,SpringBoot和mybatis Plus引起的问题。
问题原因:
问题本质:不是你代码的问题,而是「版本不兼容」
1️⃣ Spring Boot 3.x 变"严格"了
Spring Boot 3.x 底层升级到 Spring Framework 6.x 后,对 FactoryBean 做了更严格的类型校验:
❌ 不再允许 factoryBeanObjectType 是字符串
✅ 必须是:
Class 或 ResolvableType
于是初步定位是SpringBoot的版本问题。
看了一下以前写的程序,没报错的系统。。
把SpringBoot的版本改成 3.1.10,
启动就不错了,,看来是SpringBoot3.1升级到SpringBoot3.2出现问题。