整合mybatis框架

  1. 添加依赖

    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>xxx</version>
    </dependency>
    
  2. 添加配置文件

    mybatis:
      mapper-locations: classpath:mybatis/**/*Mapper.xml
      type-aliases-package: com.test.mapper.entity
      configuration:
        map-underscore-to-camel-case: true
    
  3. 在启动类上需要加入一个注解指定mapper接口的位置即可:@MapperScan("com.test.mapper")

posted @ 2024-05-16 15:21  Hanyta  阅读(3)  评论(0编辑  收藏  举报