<?xml version="1.0" encoding="UTF-8" ?>标签:xml,--,dtd,mybatis,org,config From: https://www.cnblogs.com/mikasa9826/p/16626882.html
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 引入外部配置文件(外部db.properties 优先级高) -->
<properties resource="db.properties"/>
<!-- 别名-->
<typeAliases>
<typeAlias type="com.kuang.pojo.User" alias="User"/>
<!-- 方法2
<package name="com.kuang.pojo"/>
默认首字母小写的 user 扫描包的,适于包太多,与第一种相反 -->
</typeAliases>
<!-- 改这儿切换环境 <environments default="development"> -->
<environments default="development">
<environment id="development">
<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="${pwd}"/>
</dataSource>
</environment>
<environment id="test">
<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>
<!--每一个Mapper. XML都需要在Mybatis核心配置文件中注册! -->
<mappers>
<mapper resource="com/kuang/dao/UserMapper.xml"/>
</mappers>
</configuration>