<?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> <!--引入配置文件,配置文件中包含driver,URL,username,password--> <properties resource="db.properties"></properties> <!--驼峰命名法--> <settings> <setting name="mapUnderscoreToCamelCase" value="true"/> </settings> <typeAliases> <!--1.使用package,name="完全限定名"--> <package name="cn.itlaobing.model"></package> <!--2.别名为UserinfoModel--> <!--<typeAlias type="cn.itlaobing.model.UserInfoModel" alias="UserInfoModel"/>--> <!--3.使用package,name="完全限定名",在实体类中加入注解@Alias("名称")--> <!--<package name="cn.itlaobing.model"></package>--> </typeAliases> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"></transactionManager> <dataSource type="POOLED"> <property name="driver" value="${driver}"/> <property name="url" value="${url}"/> <property name="username" value="${user}"/> <property name="password" value="${pass}"/> </dataSource> </environment> </environments> <mappers> <!--1.一次加载一个映射文件--> <!--<mapper resource="IUserInfoMapper.xml"/>--> <!--2.name="与mapper的路径相同,且.xml文件名称与mapper一样",推荐使用--> <package name="cn.itlaobing.mapper"></package> <!--3.url为绝对路径--> <!--<mapper url="file:///D:\ideaIUWorkSpace\properties01\src\main\resources\IUserInfoMapper.xml"/>--> <!--4.与package相同,多加一个名称--> <!--<mapper class="cn.itlaobing.mapper.IOrderMapper"/>--> </mappers> </configuration>
Mybatis中SqlMapConfiger.xml的常用配置
最新推荐文章于 2021-02-28 12:46:55 发布