mybatis-config.xml系统核心配置文件

configuration(配置)

    properties(属性)

    settings(设置)

    typeAliases(类型别名)

    typeHandlers(类型处理器)

    objectFactory(对象工厂)

    plugins(插件)

    environments(环境配置)

        environment(环境变量)

            transactionManager(事务管理器)

            dataSource(数据源)

    databaseIdProvider(数据库厂商标识)

    mappers(映射器)

<configuration>

    <!--导入properties文件-->
    <properties resource="db.properties"/>

 <settings>
   <setting name="logImpl" value="LOG4J"/>
    <setting name="cacheEnabled" value="true"/>
    <setting name="lazyLoadingEnabled" value="true"/>
    <setting name="multipleResultSetsEnabled" value="true"/>
    <setting name="useColumnLabel" value="true"/>
    <setting name="useGeneratedKeys" value="false"/>
    <setting name="autoMappingBehavior" value="PARTIAL"/>
    <setting name="autoMappingUnknownColumnBehavior" value="WARNING"/>
    <setting name="defaultExecutorType" value="SIMPLE"/>
    <setting name="defaultStatementTimeout" value="25"/>
    <setting name="defaultFetchSize" value="100"/>
    <setting name="safeRowBoundsEnabled" value="false"/>
    <setting name="mapUnderscoreToCamelCase" value="false"/>
    <setting name="localCacheScope" value="SESSION"/>
    <setting name="jdbcTypeForNull" value="OTHER"/>
    <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
 </settings>

配置别名   
 <typeAliases>
     <typeAlias type="com.kuang.pojo.User" alias="User"/>
 </typeAliases>

    <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.kuang.mapper.UserMapper"/>
    </mappers>

</configuration>

 

 

posted @ 2019-11-29 09:28  笑长不爱笑QvQ  阅读(338)  评论(0编辑  收藏  举报