标签:strong autoconf toc 读取配置 shu net dash 依赖包 mapper
一.官网介绍
在Mybatis官方用法中,介绍了使用Mybatis的过程:
二.使用教程
直接使用的Mybatis的教程:MyBatis使用步骤及原理
SpringBoot+Mybatis的使用教程:Spring-boot+Mybatis+Maven+MySql搭建实例
三.分析
通过教程对比,可以发现:使用Springboot框架大大简化了Mybatis的手动配置,因为默认配置已经都完成了。
在pom.xml中引入mybatis-spring-boot-starter依赖
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.2</version>
        </dependency>
通过maven插件可以看到:
mybatis-spring-boot-starter依赖包含:
mybatis-spring-boot-autoconfigure

在autoconfigure中我们可以看到:

MybatisProperties——mybatis配置文件,读取配置文件中自定义的变量,如果没有,使用默认变量

MybatisAutoConfiguration——mybatis默认配置,项目启动时初始化的Mybatis配置
 
标签:strong autoconf toc 读取配置 shu net dash 依赖包 mapper
原文地址:https://www.cnblogs.com/pyt666/p/12964673.html