mybatis配置文件开启驼峰命名

mybatis-config.xml文件中配置开启

    <settings>
        <!--配置:开启二级缓存-->
<!--        <setting name="cacheEnabled" value="true"/>-->
        <setting name="cacheEnabled" value="false"/>
        <setting name="mapUnderscoreToCamelCase" value="true"/><!--支持驼峰式命名-->
    </settings>

yml配置

#mybatis配置
mybatis:
  type-aliases-package: com.ys.springcloud.pojo
#  config-location: classpath:mybatis/mybatis-config.xml
  mapper-locations: classpath:mybatis/mapper/*.xml
  #configuration:
    #map-underscore-to-camel-case: true #开启驼峰命名
	#mapunderscoretocamelcase: true #这个和上一行相比优先级高

注意:如果使用配置文件则不能用configuration: map-underscore-to-camel-case: true 开启驼峰命名,使用的话需要把config-location: classpath:mybatis/mybatis-config.xml的配置文件路径注释掉。

posted @   渝思  阅读(820)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示