springboot3.2整合mybatis-plus详细代码示例

 更新时间:2023年12月06日 08:20:09   作者:李昊哲小课  
这篇文章主要给大家介绍了关于springboot3.2整合mybatis-plus的相关资料,Spring Boot是一个非常流行的Java Web框架,可以快速地搭建Web应用程序,需要的朋友可以参考下

springboot3.2 整合 mybatis-plus

springboot3.2 正式发布了 迫不及待地的感受了一下
结果在整个mybatis-plus 的时候遇到了如下报错

java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String

springboot mybatis-plus

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.0)

2023-11-27T11:21:35.279+08:00  INFO 38028 --- [livestreaming_commerce] [           main] c.l.LivestreamingCommerceApplication     : Starting LivestreamingCommerceApplication using Java 21.0.1 with PID 38028 (D:\dev\java\code\livestreaming_commerce\target\classes started by 64626 in D:\dev\java\code\livestreaming_commerce)
2023-11-27T11:21:35.280+08:00  INFO 38028 --- [livestreaming_commerce] [           main] c.l.LivestreamingCommerceApplication     : No active profile set, falling back to 1 default profile: "default"
2023-11-27T11:21:35.736+08:00  WARN 38028 --- [livestreaming_commerce] [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
2023-11-27T11:21:35.740+08:00  INFO 38028 --- [livestreaming_commerce] [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-11-27T11:21:35.750+08:00 ERROR 38028 --- [livestreaming_commerce] [           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) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:838) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:620) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:573) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:532) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:138) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:775) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:597) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]
	at cn.lihaozhe.LivestreamingCommerceApplication.main(LivestreamingCommerceApplication.java:10) ~[classes/:na]

主要是由于 mybatis-plus 中 mybatis 的整合包版本不够导致的
排除 mybatis-plus 中自带的 mybatis 整合包,单独引入即可

springboot mybatis-plus

<dependency>
	<groupId>com.baomidou</groupId>
	<artifactId>mybatis-plus-boot-starter</artifactId>
	<version>3.5.4.1</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>

修改依赖后正常

springboot mybatis-plus

总结

到此这篇关于springboot3.2整合mybatis-plus的文章就介绍到这了,更多相关springboot3.2整合mybatis-plus内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • Spring Boot跨域问题详解

    Spring Boot跨域问题详解

    在Spring Boot中处理跨域问题非常简单,你可以通过全局配置、注解或自定义过滤器的方式来控制跨域请求的行为,本文给大家介绍Spring Boot跨域问题简介,感兴趣的朋友跟随小编一起看看吧
    2023-09-09
  • springboot自定义校验注解的实现过程

    springboot自定义校验注解的实现过程

    这篇文章主要介绍了springboot自定义校验注解的实现过程,本文结合示例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧
    2023-11-11
  • dubbo如何设置连接zookeeper权限

    dubbo如何设置连接zookeeper权限

    这篇文章主要介绍了dubbo如何设置连接zookeeper权限问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2024-05-05
  • IDEA2019.3配置Hibernate的详细教程(未使用IDEA的自动化)

    IDEA2019.3配置Hibernate的详细教程(未使用IDEA的自动化)

    这篇文章主要介绍了IDEA2019.3配置Hibernate的详细教程,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2021-05-05
  • JPA实现多表连接查询过程

    JPA实现多表连接查询过程

    这篇文章主要介绍了JPA实现多表连接查询过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2026-06-06
  • Servlet映射路径匹配解析详解

    Servlet映射路径匹配解析详解

    servlet是javaweb用来处理请求和响应的重要对象,本文将从源码的角度分析tomcat内部是如何根据请求路径匹配得到处理请求的servlet的,感兴趣的可以了解一下
    2022-08-08
  • 如何使用Maven管理项目?Maven管理项目实例

    如何使用Maven管理项目?Maven管理项目实例

    下面小编就为大家带来一篇如何使用Maven管理项目?Maven管理项目实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-06-06
  • 带你快速了解Java中类和对象的关系

    带你快速了解Java中类和对象的关系

    这篇文章主要给大家介绍了关于Java中类和对象关系的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2021-04-04
  • java根据富文本生成pdf文件过程解析

    java根据富文本生成pdf文件过程解析

    这篇文章主要介绍了java根据富文本生成pdf文件过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2019-10-10
  • java实现在SSM下使用支付宝扫码支付功能

    java实现在SSM下使用支付宝扫码支付功能

    这篇文章主要为大家详细介绍了java实现在SSM下使用支付宝扫码支付功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2018-02-02

最新评论