此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Framework 6.2.0spring-doc.cadn.net.cn

@SqlGroup

@SqlGroup是一个容器注解,它聚合了多个@Sql附注。您可以 用@SqlGroup本机来声明几个嵌套的@Sqlannotations 的 Comments,或者你可以使用它 与 Java 8 对可重复注释的支持相结合,其中@Sql可以是 在同一个类或方法上多次声明,隐式生成此容器 注解。以下示例说明如何声明 SQL 组:spring-doc.cadn.net.cn

@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 脚本。