Springboot與MyBatis整合之后怎么進行單元測試呢,請看一下步驟:
1.在pom.xml中配置以下內容:
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>1.3.2</version>
</dependency>
2.復制一份ApplicationTests
3. 1)、使用@MybatisTest 替換@SpringBootTest;
2)、使用@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE ) 配置數據