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