对于最新稳定版本,请使用Spring Framework 7.0.1spring-doc.cadn.net.cn

@SqlConfig

@SqlConfig定义用于解析和运行SQL脚本的元数据 配置为@Sql注解。以下示例展示了如何使用它:spring-doc.cadn.net.cn

@Test
@Sql(
	scripts = "/test-user-data.sql",
	config = @SqlConfig(commentPrefix = "`", separator = "@@") (1)
)
void userTest() {
	// run code that relies on the test data
}
1 在SQL脚本中设置注释前缀和分隔符。
@Test
@Sql("/test-user-data.sql", config = SqlConfig(commentPrefix = "`", separator = "@@")) (1)
fun userTest() {
	// run code that relies on the test data
}
1 在SQL脚本中设置注释前缀和分隔符。