1、mybatis整合spring
(1)pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
(2)application.properties
# DataSourceProperties
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/community?characterEncoding=utf-8&sueSSL=false&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
#最大连接数
spring.datasource.hikari.maximum-pool-size=15
#最小空闲连接
spring.datasource.hikari.minimum-idle=5
#超时时间30000毫秒
spring.datasource.hikari.idle-timeout=30000
#MybatisProperties
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.guang.community.entity
#自动生成组件
mybatis.configuration.use-generated-keys=true
#create_time与createTime的转换
mybatis.configuration.map-underscore-to-camel-case=true