对于最新的稳定版本,请使用 Spring Framework 7.0.6!spring-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脚本中设置注释前缀和分隔符。