1 导入依赖
在pom.xml中导入依赖:
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>
2 配置MyBatis
在application.yml中配置:
mybatis:
mapper-locations: classpath:cn/dxc/mapper/*Mapper.xml
3 配置Mapper接口扫描包
@SpringBootApplication
@MapperScan("cn.dxc.web.controller.mapper")
public class ApplicationConfig {
...
}