Mybatis學習總結(二
阿新 • • 發佈:2019-02-06
在Mybatis配置XML文件中的標籤必須嚴格遵循以上的順序,如果把<mapper>放到<envieronment>上,則報錯。
properties標籤
利用標籤可以引用外部的配置檔案,並在mybatis.xml檔案中使用<properties resource="org/mybatis/example/config.properties"> <property name="username" value="dev_user"/> <property name="password" value="F2Fa3!33TYyg"/> </properties>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
settings標籤
這是 MyBatis 中極為重要的調整設定,它們會改變 MyBatis 的執行時行為。typeAliases標籤
參考文件 http://www.mybatis.org/mybatis-3/zh/configuration.html