开发者

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

目录

    springboot3.2 整合 myBATis-plus

    springboot3.2 正式发布了 迫不及待地的感受了一下

    结果在整个mybatis-plus 的时候遇到了如下报错

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

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

      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    js \\/  js___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::                (v3.2.0)
    
    2023-11-27T11:21:35.279+08:00  INFO 38028 --- [livestreaming_commerce] [           main] c.l.LivestreamingCommerceApplication     : Starting LivestreamingCommerceApplicatiophpn 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_commerhttp://www.devze.comce] [           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] javascripto.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 整合包,单独引入即可

    springboot3.2整合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>
    

    修改依赖后正常

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

    总结

    到此这篇关于springboot3.2整合mybatis-plus的文章就介绍到这了,更多相关springboot3.2整合mybatis-plus内容请搜索编程客栈(www.devze.com)以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程客栈(www.devze.com)!

    0

    上一篇:

    下一篇:

    精彩评论

    暂无评论...
    验证码 换一张
    取 消

    最新开发

    开发排行榜