【Springboot 3.2.1 & mybatis-plus】Invalid value type for attribute 'factoryBeanObjectType': java.l...

我將項(xiàng)目由springboot3.0.5升級(jí)為3.2.1時(shí)啟動(dòng)報(bào)錯(cuò)如下:
2024-01-08 14:59:34.245 ERROR 15604 --- [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBeanFromAttributes(FactoryBeanRegistrySupport.java:86)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:836)
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:620)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:575)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:534)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:138)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:789)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:606)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:464)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1358)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1347)

解決:pom.xml的mybatis-spring 版本升級(jí)為 3.0.3

<dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
                <version>3.5.5</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.mybatis</groupId>
                        <artifactId>mybatis-spring</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
                <version>3.0.3</version>
            </dependency>

參考:Spring Boot 升級(jí) 3.2 報(bào)錯(cuò) Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String_java_有來技術(shù)團(tuán)隊(duì)-華為開發(fā)者聯(lián)盟HarmonyOS專區(qū) (csdn.net)
https://github.com/mybatis/spring/issues/855
https://github.com/baomidou/mybatis-plus/issues/5808

mybatis-plus-boot-starter(或mybatis-plus-spring-boot3-starter)升級(jí)到3.5.5

<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>
<dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
                <version>3.0.3</version>
            </dependency>

<dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
                <version>3.5.5</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.mybatis</groupId>
                        <artifactId>mybatis-spring</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
                <version>3.0.3</version>
            </dependency>

要不會(huì)報(bào)

Bean named 'ddlApplicationRunner' is expected to be of type 'org.springframework.boot.Runner' but was actually of type 'org.springframework.beans.factory.support.NullBean'
image.png

參考:Bean named‘ddlApplicationRunner‘is expected to be of type ‘org.springframework.boot.Runner‘_spring boot項(xiàng)目啟動(dòng)報(bào)錯(cuò) bean named 'ddlapplicationrunner-CSDN博客
【Springboot 3.2.1 & mybatis-plus】升級(jí)版本遇到的問題_bean named 'ddlapplicationrunner' is expected to b-CSDN博客
SpringBoot3和mybatisplus整合出現(xiàn)的問題_bean named 'ddlapplicationrunner' is expected to b-CSDN博客
springboot3.2.1集成Mybatisplus啟動(dòng)報(bào)錯(cuò)(沒事的時(shí)候就坑自己)_springboot 3.2.1整合mybatis-plus-CSDN博客
SpringBoot 3.2.1 啟動(dòng)報(bào)錯(cuò) · Issue #5867 · baomidou/mybatis-plus · GitHub
【SpringBoot3集成Mybatis-plus】啟動(dòng)報(bào)錯(cuò)問題解決-CSDN博客

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容