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 7 <!-- 引入properties文件 --> 8 <properties resource="jdbc.properties"/> 9 10 <!-- 全局配置 --> 11 <settings> 12 <!-- 打印Mybatis运行日志 --> 13 <setting name="logImpl" value="STDOUT_LOGGING"/> 14 <!- opening the secondary cache -> 15 <Setting name = "cacheEnabled" value = "to true" /> 16 <-! lazy loading opening (lazy loading) -> . 17 <Setting name = "lazyLoadingEnabled" value = "to true" /> 18 is <-! to false is lazy loading, true is preloaded (emergency loading) -> . 19 <Setting name = "aggressiveLazyLoading" value = "to false" /> 20 is </ Settings> 21 is 22 is <-! alias to the subject -> 23 < typeAliases> 24 <-! <typeAlias type = "com.lovo.j173mybatis.bean.UserBean" Alias = "sfasdf" /> -> 25 < Package name = "com.lovo.j173mybatis. bean"/> 26 </typeAliases> 27 28 <Environments default = "Develoment"> 29 <Environment the above mentioned id = "Develoment"> 30 <-! tell Mybatis transaction management using JDBC manage affairs -> 31 <transactionManager of the type = "JDBC" /> 32 <! - configure data sources: a database which tells Mybatis connection configuration. 1 -> 33 is > - <- <type the dataSource = "the POOLED"!> 34 is <- <Property name = "Driver" value = "com.mysql! .jdbc.Driver "/> -> 35 ! <- <Property name =" url "value =" jdbc: MySQL: // localhost: 3306 / j173web characterEncoding = UTF-8 "/> ->? 36 < ! -- <property name="username" value="root"/> --> 37 <!-- <property name="password" value="lovo"/> --> 38 <!-- </dataSource> --> 39 <!-- 配置数据源:告诉Mybatis连接哪一个数据库 配置方法2--> 40 <dataSource type="POOLED"> 41 <property name="driver" value="${jdbc_driver}"/> 42 <property name="url" value="${jdbc_url}"/> 43 <property name="username" value="${jdbc_username}"/> 44 <property name="password" value="${jdbc_password}"/> 45 </dataSource> 46 </environment> 47 </environments> 48 49 <! - Mapping Register File -> 50 <by mappers> 51 is <= Resource Mapper "absolute Road King .xml" /> 52 is 53 is </ by mappers> 54 is </ Configuration> 55