springboot整合mybatis驼峰映射
时间: 2023-08-21 15:08:31 浏览: 169
springboot整合mybatis
在SpringBoot中,可以通过配置文件application.yml来实现mybatis的驼峰映射。具体的配置如下:
```yaml
mybatis:
configuration:
map-underscore-to-camel-case: true
```
通过设置map-underscore-to-camel-case属性为true,可以使得数据库表中的下划线命名的字段在查询结果映射到JavaBean时,自动转换为驼峰命名的属性名。这样就能避免查询结果封装到JavaBean中出现null值的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [SpringBoot整合Mybatis 配置驼峰命名、实体类包、mapper文件映射](https://blog.csdn.net/m0_55051386/article/details/121683262)[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/universsky2015/article/details/119028309)[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 ]
阅读全文