~~~~spring中整合mybatis

myBatis运行逻辑剖析

一,在pom.xml文件中增加所需依赖:

mysql驱动依赖
<dependency>   <groupId>mysql</groupId>   <artifactId>mysql-connector-java</artifactId>   <scope>runtime</scope></dependency>
spring jdbc 依赖
<dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-data-jdbc</artifactId></dependency>
mybatis starter 依赖
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.3</version></dependency>

二,在application.properties 配置文件中增加繁难配置

连接池配置
spring.datasource.url=jdbc:mysql://localhost:3306/dbgoods?serverTimezone=GMT%2B8&characterEncoding=utf8spring.datasource.username=rootspring.datasource.password=root
mybatis配置
mybatis.mapper-locations=classpath:/mapper/*/*.xml