在SqlMapConfig.xml 中<typeAliases>与<properties>的关系

先来个正确的写法

<properties resource="jdbc.properties"/>
    <!-- 设置别名 -->
    <typeAliases>
        <!-- <typeAlias type="com.mybatis.review.entity.User" alias="User"/> -->
        <package name="com.mybatis.review" />
    </typeAliases>
1、如果出现<properties> 则<typeAliases>必须跟在<properties>后面
2、如果没有<properties>,<typeAliases>必须放在SqlMapConfig.xml文件的最上面

猜你喜欢

转载自www.cnblogs.com/404code/p/10620526.html