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 @ 2022-09-18 15:21  渝思  阅读(754)  评论(0编辑  收藏  举报