@SqlGroup
@SqlGroup
是一个容器注解,它聚合了多个 @Sql
注解。您可以本地使用 @SqlGroup
声明多个嵌套 @Sql
注解,或者可以将其与 Java 8 对可重复注解的支持结合使用,其中 @Sql
可以多次在同一个类或方法上声明,隐式生成此容器注解。以下示例展示了如何声明 SQL 组:
@SqlGroup
is a container annotation that aggregates several @Sql
annotations. You can
use @SqlGroup
natively to declare several nested @Sql
annotations, or you can use it
in conjunction with Java 8’s support for repeatable annotations, where @Sql
can be
declared several times on the same class or method, implicitly generating this container
annotation. The following example shows how to declare an SQL group:
- Java
-
@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 | Declare a group of SQL scripts.
|
2 | Declare a group of SQL scripts. |