springboot和mybatisplus整合报错
·
报错Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String或者xxxController/xxxService/xxxMapper的bean无法被创建。
原因mybatisplus中的mybatis-spring版本过低,与springboot版本冲突

解决方法:
手动排除并手动加入mybatis-spring的依赖
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.5</version>
<exclusions>
<exclusion>
<artifactId>mybatis-spring</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>3.0.3</version>
</dependency>
本人对应的父依赖spring-boot-starter-parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
</parent>
2024-6-18 踩坑:springboot 和mybatisplus 整合后,@Service 注解是写在Service接口的实现类上,不是写在Service接口上!!!!!!!!
按照mybatis的写法,@Service 注解一般写在接口上 ,故犯错。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)