当前位置: 首页 > article >正文

springboot3项目整合Mybatis-plus启动项目报错:Invalid bean definition with name ‘xxxMapper‘

springboot3+jdk17+Mybatis-plus运行项目时报错如下:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-11-04T22:03:02.722+08:00 ERROR 18880 --- [backend] [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'userMapper' defined in file [E:\Project\idea_java_Project\spring\kob_2\backend\target\classes\com\kob\backend\mapper\UserMapper.class]: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:857) ~[spring-beans-6.1.13.jar:6.1.13]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getType(AbstractBeanFactory.java:743) ~[spring-beans-6.1.13.jar:6.1.13]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAnnotationOnBean(DefaultListableBeanFactory.java:735) ~[spring-beans-6.1.13.jar:6.1.13]
	at org.springframework.boot.sql.init.dependency.AnnotationDependsOnDatabaseInitializationDetector.detect(AnnotationDependsOnDatabaseInitializationDetector.java:36) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.sql.init.dependency.DatabaseInitializationDependencyConfigurer$DependsOnDatabaseInitializationPostProcessor.detectDependsOnInitializationBeanNames(DatabaseInitializationDependencyConfigurer.java:152) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.sql.init.dependency.DatabaseInitializationDependencyConfigurer$DependsOnDatabaseInitializationPostProcessor.postProcessBeanFactory(DatabaseInitializationDependencyConfigurer.java:115) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:363) ~[spring-context-6.1.13.jar:6.1.13]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:197) ~[spring-context-6.1.13.jar:6.1.13]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:789) ~[spring-context-6.1.13.jar:6.1.13]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:607) ~[spring-context-6.1.13.jar:6.1.13]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.4.jar:3.3.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.4.jar:3.3.4]
	at com.kob.backend.BackendApplication.main(BackendApplication.java:10) ~[classes/:na]


解决方案:

将pom.xml中,本来用的:

 <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.8</version>
        </dependency>

改为了:

 <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
            <version>3.5.8</version>
        </dependency>

http://www.kler.cn/a/379418.html

相关文章:

  • 气象大模型学习笔记
  • 学webpack之loader原理,让面试官跪下来唱征服
  • django的models使用介绍。
  • ElasticSearch - Bucket Script 使用指南
  • lost+found目录实现文件找回的原理
  • npm入门教程18:npm发布npm包
  • 基于SpringBoot+微信小程序+协同过滤算法+二维码订单位置跟踪的农产品销售平台-新
  • 一文搞懂python虚拟环境配置及使用pyenv进行python多版本管理
  • RT-Thread学习
  • 基于SSM+微信小程序的社团登录管理系统(社团1)
  • Android Studio Gradle没有assembleRelease等选项的解决方法
  • 2024快手面试算法题-生气传染
  • HTML+CSS科技感时钟(附源码!!!)
  • 浅谈vuex和pinia的区别
  • 什么是虚拟dom,如何实现一个虚拟dom
  • 硅谷甄选(10)用户管理
  • HTML5 + CSS3 + JavaScript 编程语言学习教程
  • Rust编程中的浮点数比较
  • Spring Boot 3.x 整合 Druid 数据库连接池(含密码加密)
  • Docker安装MySQL8.0
  • LeetCode 热题100 之 回溯1
  • 已解决:VS2022一直显示编译中但无法运行的情况
  • 贝叶斯+PINN!双重热点buff叠加,轻松斩获Nature子刊!
  • 人工智能技术的演变与未来:前景、挑战与应对
  • Lobe Chat:你的私人AI助理
  • Kimi出考题,考题提示词Prompt附上,培训机构试题、期中考试、人事入职试题全搞定