mybatis frame configuration

mybatis configuration

1. header information

<?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">;
mybatis frame configuration

Configuration information <configuration>

<Configuration>
mybatis frame configuration
(. 1) introduced into an external file
db.properties below in src

driver=com.mysql.jdbc.Driver
url=jdbc:mysql:///db02
username=root
password=529578740
mybatis frame configuration

<properties resource=”db.properties”/>
<properties resource="db.properties"/>
mybatis frame configuration

(2) settings of the configuration (open camelCasing manner, outputs information related sql console)
<Settings>
<Setting name = "mapUnderscoreToCamelCase" value = "to true" />
<Setting name = "logImpl" value = "STDOUT_LOGGING" />
</ Settings>
mybatis frame configuration

(3) Configure alias
<typeAliases>
<-! Go type represents the path, alias is an alias ->
<-! <TypeAlias type = "com.kgc.pojo.User" Alias = "the User" / > ->

<!--自动扫描这个包,可以配置所有的别名-->
<package name="com.kgc.pojo"/>

</ typeAliases>
mybatis frame configuration
(4) Environment Configuration
<Environments default = "Development">
<-! Development Environment Configuration ->
<Environment the above mentioned id = "Development">
<-! Transaction Manager ->
<transactionManager of the type = " the JDBC "/>
<-! configuration data sources ->
<type the dataSource =" the POOLED ">
<Property name =" Driver "value =" $ {Driver} "/>
<Property name =" URL "value =" $ {URL} "/>
<Property name =" username "value =" $ {username} "/>
<Property name =" password "value =" $ {password} "/>
</ the dataSource>
</ Environment>
< / Environments>
mybatis frame configuration
(. 5) introduced into the mapper
mybatis frame configuration
(. 6)
<by mappers>
<mapper resource="com/kgc/pojo/UserMapper.xml"/>
</mappers>
</config
mybatis frame configuration

Guess you like

Origin blog.51cto.com/14441795/2428526