在使用SpringBoot+MybatisPlus时,运行启动类时报了这个错误,具体信息是:
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-03-17T01:12:42.626+08:00 ERROR 20576 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'ddlApplicationRunner' is expected to be of type 'org.springframework.boot.Runner' but was actually of type 'org.springframework.beans.factory.support.NullBean'
根据错误日志显示,Spring Boot 应用程序启动失败
并且报告了 BeanNotOfRequiredTypeException异常。异常的详细信息是:
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'ddlApplicationRunner' is expected to be of type 'org.springframework.boot.Runner' but was actually of type 'org.springframework.beans.factory.support.NullBean'
这个异常表明名为 'ddlApplicationRunner' 的 Bean
被期望是类型为 'org.springframework.boot.Runner',
但实际上却是类型为 'org.springframework.beans.factory.support.NullBean'。
要解决这个问题,应该检查应用程序的配置和依赖项,尤其是与 'ddlApplicationRunner' 相关的配置。可能存在配置错误或依赖项版本不匹配等问题。
解决办法:
我的SpringBoot的版本是3.2.3,MybatisPlus的版本为3.5.4.1,
把MybatisPlus的版本更改为3.4.3就不报错了