mybatis-plus3.4.1版本 CRUD 全局变量配置 com.baomidou.mybatisplus.entity.GlobalConfiguration失效

2022-07-26,,,,

com.baomidou.mybatisplus.entity.GlobalConfiguration失效

  • 解决步骤
    • 在applicationContext.xml文件中添加GlobalConfiguration的替代类:
    • 其他属性请参照[MyBatis-Plus官方文档](https://baomidou.com/config/)


在mybatis-plus3.4.1 版本GlobalConfiguration失效


提示:以下是本篇文章正文内容,下面案例可供参考

解决步骤

在applicationContext.xml文件中添加GlobalConfiguration的替代类:

configuration 和 globalConfig 二选一即可

<bean id="sqlSessionFactoryBean" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
        <property name="configLocation" value="classpath:mybatis-config.xml"></property>
        <property name="typeAliasesPackage" value="com.mp.beans"></property>
<!--        <property name="configuration" ref="configuration"/> &lt;!&ndash;  非必须  &ndash;&gt;-->
        <property name="globalConfig" ref="globalConfig"/> <!--  非必须  -->
    </bean>

<!--    <bean id="configuration" class="com.baomidou.mybatisplus.core.MybatisConfiguration">-->
<!--    </bean>-->

    <bean id="globalConfig" class="com.baomidou.mybatisplus.core.config.GlobalConfig">
        <property name="dbConfig" ref="dbConfig"/> <!--  非必须  -->
    </bean>

    <bean id="dbConfig" class="com.baomidou.mybatisplus.core.config.GlobalConfig.DbConfig">
        <property name="idType" value="AUTO"></property>
    </bean>

其他属性请参照MyBatis-Plus官方文档

本文地址:https://blog.csdn.net/weixin_44837082/article/details/110870602

《mybatis-plus3.4.1版本 CRUD 全局变量配置 com.baomidou.mybatisplus.entity.GlobalConfiguration失效.doc》

下载本文的Word格式文档,以方便收藏与打印。