@SqlGroup

@SqlGroup 是一個容器註解,它聚合了多個 @Sql 註解。你可以原生使用 @SqlGroup 來宣告多個巢狀的 @Sql 註解,或者你可以結合 Java 8 對可重複註解的支援來使用它,在這種情況下,可以在同一個類或方法上多次宣告 @Sql,隱式生成此容器註解。以下示例展示瞭如何宣告一個 SQL 組

  • Java

  • Kotlin

@Test
@SqlGroup({ (1)
	@Sql(scripts = "/test-schema.sql", config = @SqlConfig(commentPrefix = "`")),
	@Sql("/test-user-data.sql")
})
void userTest() {
	// run code that uses the test schema and test data
}
1 宣告一組 SQL 指令碼。
@Test
@SqlGroup( (1)
	Sql("/test-schema.sql", config = SqlConfig(commentPrefix = "`")),
	Sql("/test-user-data.sql"))
fun userTest() {
	// run code that uses the test schema and test data
}
1 宣告一組 SQL 指令碼。
© . This site is unofficial and not affiliated with VMware.