SpringBoot-Mybatis关于开启驼峰映射的设置

  1. 在application.properties文件中添加:

    1
    mybatis.configuration.map-underscore-to-camel-case=true
  2. 在mybatis的配置文件,如mybatis-config.xml中进行配置

    1
    2
    3
    4
    5
    6
    7
    <configuration>
    <!-- 开启驼峰映射 ,为自定义的SQL语句服务-->
    <!--设置启用数据库字段下划线映射到java对象的驼峰式命名属性,默认为false-->
    <settings>
    <setting name="mapUnderscoreToCamelCase" value="true"/>
    </settings>
    </configuration>