spring boot 整合Mybatis
一. 导jar包
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
二. 然后在application.propertiies下进行配置
#加载Mybatis配置文件
mybatis.mapper-locations=classpath:mapper/*Mapper.xml
mybatis.config-location=classpath:mapper/config/sqlMapConfig.xml
#定义别名
mybatis.type-aliases.package=com.ls.po
#加载数据源
spring.datasource.url=jdbc:mysql://localhost:3306/mybatis01
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=admin
三. 添加mysql驱动包
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>