对于最新的稳定版本,请使用 Spring Framework 6.2.0! |
@SqlGroup
@SqlGroup
是一个容器注解,它聚合了多个@Sql
附注。您可以
用@SqlGroup
本机来声明几个嵌套的@Sql
annotations 的 Comments,或者你可以使用它
与 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 脚本。 |