springboot 集成mybatis 踩坑@MapperScan问题

导包

 <dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.1.4</version>
 </dependency>
 <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
 </dependency>

配置

# xml加载路径
mybatis:
  mapper-locations: classpath:mapper/*.xml
 # 数据库配置
datasource:
  username: root
  password: root
  url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
  driver-class-name: com.mysql.jdbc.Driver

出现@MapperScan  启动异常问题,检查mybatis-spring-boot-starter版本问题version是否指定

猜你喜欢

转载自blog.csdn.net/wdz985721191/article/details/115115111