<?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 resource="db.properties"></properties>
<!-- 全局setting -->
<!--
<settings>
</settings>
-->
<!-- 别名定义 -->
<typeAliases>
<!-- 1.单个别名定义 -->
<!-- <typeAlias type="pw.goyd.domain.User" alias="User"/> -->
<!-- 2.批量定义(常用) alias名首字母大小写都可以 -->
<package name="pw.goyd.game.model"/>
</typeAliases>
<!-- Spring中废弃 -->
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<!-- 配置数据库连接信息 上面加载了properties -->
<dataSource type="POOLED">
<property name="driver" value="${jdbc.driver}" />
<property name="url" value="jdbc:mysql://${jdbc.host}:${jdbc.port}/${jdbc.dbname}?useSSL=false&characterEncoding=utf-8" />
<property name="username" value="${jdbc.user}" />
<property name="password" value="${jdbc.pass}" />
</dataSource>
</environment>
</environments>
<!-- 注册mapper -->
<mappers>
<!-- 1.加载单个映射文件-->
<!-- <mapper resource="pw/goyd/mapping/UserMapper.xml"/> -->
<!-- 2.用mapper代理方法
xml和class保持一致
将mapper.xml和mapper interface放在同一目录 -->
<!-- <mapper class="pw.goyd.mapping.UserMapper"/> -->
<!-- 2.批量加载 -->
<package name="pw.goyd.db.mapping"/>
</mappers>
</configuration>
本文地址:https://www.stanwind.com/post/14
版权声明:若无注明,本文皆为“Make it Better”原创,转载请保留文章出处。