@Sql

@Sql用于注释测试类或测试方法,以配置要运行的 SQL 脚本 在集成测试期间针对给定数据库。以下示例演示如何使用 它:spring-doc.cadn.net.cn

@Test
@Sql({"/test-schema.sql", "/test-user-data.sql"}) (1)
void userTest() {
	// run code that relies on the test schema and test data
}
1 为此测试运行两个脚本。
@Test
@Sql("/test-schema.sql", "/test-user-data.sql") (1)
fun userTest() {
	// run code that relies on the test schema and test data
}
1 为此测试运行两个脚本。