Linux 拨号vps windows公众号手机端

mybatis驼峰命名怎么配置

lewis 8年前 (2017-01-14) 阅读数 11 #程序编程
文章标签 mybatis

在MyBatis中配置驼峰命名可以通过在配置文件中添加以下设置实现:

  1. 在mybatis-config.xml或者application.properties中配置:
<settings>
    <setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
  1. 在SpringBoot中配置application.properties文件:
mybatis.configuration.map-underscore-to-camel-case=true

这样配置之后,MyBatis会自动将数据库中的下划线命名转换为驼峰命名,例如数据库字段名为user_name,会被映射为Java类属性名为userName。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门