MyBatis Camel Case Configuration Guide

Configuring camel case naming in MyBatis can be achieved by adding the following settings in the configuration file.

  1. Configure in mybatis-config.xml or application.properties:
<settings>
    <setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
  1. Configuring the application.properties file in SpringBoot:
mybatis.configuration.map-underscore-to-camel-case=true

After this configuration, MyBatis will automatically convert the underscore naming in the database to camel case naming. For example, a database field named user_name will be mapped as a Java class property named userName.

bannerAds