您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页springboot和mybatisplus整合报错

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 注解一般写在接口上 ,故犯错。

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务