springboot 中mybatis 配置

1.导入

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.1.1</version>
</dependency>

 

2.配置

在application.yml中加入如下配置

复制代码
debug: false
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456
    url: jdbc:mysql://127.0.0.1:3306/mall?characterEncoding=utf-8&useUnicode=true
mybatis:
  mapper-locations: classpath:mybatis/mapping/*.xml
  type-aliases-package: com.cj.pojo
  configuration:
    map-underscore-to-camel-case: true
复制代码

 

3.驼峰命名

mybatis.configuration.map-underscore-to-camel-case: true

 

posted @   写代码的小哥哥  阅读(962)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
点击右上角即可分享
微信分享提示