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