mybatis提供了3种配置方式
一:property子元素
二:properties配置文件
三:程序参数传递
一:property子元素
<configuration>
<properties >
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</properties>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
二:properties配置文件
<configuration>
<properties resource="db.properties">
<property name="driver" value="driver"/>
<property name="url" value="url"/>
<property name="username" value="username"/>
<property name="password" value="password"/>
</properties>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/nbg/dao/UserMapper.xml"/>
</mappers>
</configuration>
三: