SqlMapConfig.xml配置文件
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE configuration 3 PUBLIC "-//mybatis.org//DTD Config 3.0//EN" 4 "http://mybatis.org/dtd/mybatis-3-config.dtd"> 5 <configuration> 6 <!-- 和spring整合后 environments将废除 --> 7 <environments default="development"> 8 <environment id="development"> 9 <!-- 使用JDBC事务管理,事务控制由mybatis --> 10 <transactionManager type="JDBC"/> 11 <!-- 数据库连接池,由mybatis --> 12 <dataSource type="POOLED"> 13 <property name="driver" value="com.mysql.jdbc.driver"/> 14 <property name="url" value="jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf-8"/> 15 <property name="username" value="root"/> 16 <property name="password" value=""/> 17 </dataSource> 18 </environment> 19 </environments> 20 </configuration>
SqlMapConfig.xml是mybatis的核心配置文件,上面配置内容为数据源和事务管理