最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
SpringBoot中的Mybatis依赖问题代码示例
时间:2022-06-29 01:48:37 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下SpringBoot中的Mybatis依赖问题代码示例,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
Pom导入依赖
org.mybatis.spring.boot mybatis-spring-boot-starter 2.0.0
application.yml
#配置数据源,yml格式 spring: datasource: url: jdbc:mysql://127.0.0.1:3306/dianping?useUnicode=true&characterEncoding=utf8 username: root password: 123 driver-class-name: com.mysql.jdbc.Driver #指定mybatis映射文件的地址 mybatis: mapper-locations: classpath:mapper/*.xml
项目结构
mybatis默认是属性名和数据库字段名一一对应的,即
数据库表列:user_name
实体类属性:user_name
但是java中一般使用驼峰命名
数据库表列:user_name
实体类属性:userName
在Springboot中,可以通过设置map-underscore-to-camel-case属性为true来开启驼峰功能。
application.properties中:
mybatis: configuration: map-underscore-to-camel-case: true
相关文章
- 诛仙2尊师重道奇遇坐标是什么 尊师重道中原奇遇攻略 08-18
- 四海兄弟故乡复活节庆祝活动报纸在哪 复活节报纸位置介绍 08-18
- 龙魂旅人零氪和微氪玩家怎么选角色 角色选择推荐 08-18
- 龙魂旅人装备洗练怎么弄 装备洗练方法介绍 08-18
- 诛仙2渔船启运怎么做 渔船启运中原奇遇完成方法 08-18
- 龙魂旅人每日幸运奥义组合怎么触发 幸运奥义组合触发方法一览 08-18