springboot mybatis 驼峰
时间: 2023-08-20 08:06:46 浏览: 119
在Spring Boot中,可以通过配置`map-underscore-to-camel-case`属性为true来开启驼峰命名功能。有多种方式可以进行配置。一种方式是在application.yml文件中设置`mybatis.configuration.map-underscore-to-camel-case`为true。另一种方式是通过在配置类上使用`@Configuration`注解,并在`SqlSessionFactory`的配置方法中设置`bean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true)`来开启驼峰命名转换。还可以通过在application.properties文件中设置`mybatis.configuration.mapUnderscoreToCamelCase=true`或`mybatis.configuration.map-underscore-to-camel-case=true`来进行配置。以上两种方式根据自己的IDE版本选择其中一种进行配置即可。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Springboot系列之8.2:Mybatis属性映射](https://blog.csdn.net/qq_32534441/article/details/90108573)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Springboot整合mybatis配置下划线转驼峰](https://blog.csdn.net/qq_39084358/article/details/101273745)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文