springboot整合mybatis

    科技2022-07-13  117

    1.添加启动器依赖

    <!--mybatis --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.0.1</version> </dependency>

    2.配置Mybatis

    在配置文件中配置如下

    mybatis: # 实体类别名包路径 type-aliases-package: com.itheima.pojo # 映射文件路径 # mapper-locations: classpath:mappers/*.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

    3.配置MapperScan

    添加@MapperScan标签扫描

    Processed: 0.010, SQL: 8