小工具知识网

当前位置: 首页 > 行业知识 > Springboot3整合myBatisplus报错:Bean named ‘ddlApplicationRunner‘ is expected to be of type ‘org.sprin

行业知识

Springboot3整合myBatisplus报错:Bean named ‘ddlApplicationRunner‘ is expected to be of type ‘org.sprin

2026-11-12 08:54:43 来源:互联网转载

1、错误:

���用Springboot3.1.7整合myBatisplus3.5.3时,出现下面的错误:

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

明明我的代码刚开始写,就起了一个头,竟然报错了!

demo框架如下:

(1)Demo1Application.java

(2)controller层:JOJOController.java

(3)service层:JOJOService.java

(4)mapper层:JOJOMapper.java

(5)数据库实体类:jojo.java

(6)pom.xml

    4.0.0            org.springframework.boot        spring-boot-starter-parent        3.1.7                 com.example    demo1    0.0.1-SNAPSHOT    demo1    demo1            17                            org.springframework.boot            spring-boot-starter-web                            com.mysql            mysql-connector-j            runtime                            org.projectlombok            lombok            true                            org.springframework.boot            spring-boot-starter-test            test                            com.baomidou            mybatis-plus-boot-starter            3.5.3                                                    org.springframework.boot                spring-boot-maven-plugin                                                            paketobuildpacks/builder-jammy-base:latest                                                                                            org.projectlombok                            lombok                                                                                    

是不是看起来非常正确!!没感觉有什么问题,有很多博客说要加上@MapperScan("com.example.demo1.mapper")之类的,但是我是加上了,还是有错误。

坑就在于springboot3.1.7需要更高版本的myBatisPlus!

2、解决办法:

把myBatisplus的版本升级到3.5.5,就可以了!!!

把

                    com.baomidou            mybatis-plus-boot-starter            3.5.3        

改为

                    com.baomidou            mybatis-plus-boot-starter            3.5.5        

上一篇:指纹采集技术

下一篇:链接服务器名称怎么写好?