1.在pom.xml文件中引入MyBatis依赖:
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
2.在启动类上配置扫包:这样配置可以省略在每一个mapper接口上写@Mapper,及可自动扫描mapper包下的类。
@MapperScan(basePackages="com.*.mapper")