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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM