首先看一下项目的整体结构

1.导入依赖
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.chujianyun</groupId>
<artifactId>h2-unit-test-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties/>
<parent>
<artifactId>spring-boot-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.1.1.RELEASE</version>
</parent>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web<

本文介绍了如何在SpringBoot项目中结合Mybatis进行单元测试,包括引入依赖、创建实体类、Mapper接口及XML配置、配置属性文件以及编写BaseTest基类和具体测试用例。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



