mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 04:08:43 +08:00 
			
		
		
		
	【升级】spring-boot from 2.4.12 to 2.5.9,最新的 Spring Boot 2.6.X 在等更流行一些,稳定第一
This commit is contained in:
		@@ -20,6 +20,7 @@ import org.springframework.test.context.jdbc.Sql;
 | 
			
		||||
 */
 | 
			
		||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class)
 | 
			
		||||
@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
 | 
			
		||||
@Sql(scripts = "/sql/create_tables.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) // 每个单元测试结束前,创建表
 | 
			
		||||
@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
 | 
			
		||||
public class BaseDbUnitTest {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,6 @@ spring:
 | 
			
		||||
    driver-class-name: org.h2.Driver
 | 
			
		||||
    username: sa
 | 
			
		||||
    password:
 | 
			
		||||
    schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具
 | 
			
		||||
    druid:
 | 
			
		||||
      async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
 | 
			
		||||
      initial-size: 1 # 单元测试,配置为 1,提升启动速度
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user