mybatis-config.xml
<?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核心配置文件-->
<configuration>
<!--引入外部配置文件-->
<properties resource="db.properties" >
<property name="username" value="root"/>
<property name="password" value="123456"/>
</properties>
<settings>
<!--配置日志工厂-->
<setting name="logImpl" value="STDOUT_LOGGING"/>
<!--显示的开启全局缓存-->
<setting name="cacheEnabled" value="true"/>
</settings>
<!--可以给实体类起别名-->
<typeAliases>
<!--标准的日志工厂实现-->
<package name="com.deng.pojo"/>
</typeAliases>
<!--environments环境,这里是开发development-->
<environments default="development">
<environment id="development">
<!--transactionManager事务管理-->
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper class="com.deng.dao.UserMapper"/>
</mappers>
</configuration>