Study notes: MyBatis basic configuration file

Mybatis configuration file (mybatis.xml) is the basic configuration file that we must master in the process of using Mybatis. In this configuration file, we often configure the following tags:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">

<!--
    该配置文件中包含一个configuration节点
        里面有配置信息 分别是环境和映射
         其中环境里有datasource,里面有我们熟悉的连接数据库的四个字符串
-->
<configuration>
<properties resource="dbcp.properties"/>
    <settings>
        <setting name="logImpl" value="STDOUT_LOGGING"/>
    </settings>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="${driverClassName}"/>
                <property name="url" value="${url}"/>
                <property name="username" value="${username}"/>
                <property name="password" value="${password}"/>
            </dataSource>
        </environment>
    </environments>
    <!--
		mappre标签中长添加配置文件的映射路径
-->
 <mappers>
        <mapper resource="org/mybatis/example/BlogMapper.xml"/>
    </mappers>

Guess you like

Origin blog.csdn.net/qq_45349018/article/details/104809900