<?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>
<!-- 这是吧账号密码放在了这个properties里面,再读取一下 -->
<!-- 设置类的别名 alias就是设置别名-->
<typeAliases>
<typeAlias type="com.qianfeng.curd.Person" alias="Person"/>
</typeAliases>
<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="${password}" /> diver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/my1804
username=root password=lin -->
<!-- ${} 读取属性文件中的数据 -->
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/mybatis1804" />
<property name="username" value="root" />
<property name="password" value="lin" />
</dataSource>
</environment>
</environments>
<!-- 引入映射文件 -->
<mappers>
<mapper resource="com/qianfeng/first/PersonMapper.xml" />
</mappers>
</configuration>
网友评论