Support inlined SQL statements in @Sql

Prior to this commit, it was only possible to declare SQL statements
via @Sql within external script resources (i.e., classpath or file
system resources); however, many developers have inquired about the
ability to inline SQL statements with @Sql analogous to the support for
inlined properties in @TestPropertySource.

This commit introduces support for declaring _inlined SQL statements_
in `@Sql` via a new `statements` attribute. Inlined statements are
executed after statements in scripts.

Issue: SPR-13159
This commit is contained in:
Sam Brannen
2015-06-23 20:36:37 +02:00
parent 3da59178e5
commit 10a691bd51
6 changed files with 181 additions and 34 deletions

View File

@@ -573,6 +573,8 @@ public @interface MyTestConfig {
_before_ a test -- for example, if some rogue (i.e., yet to be
determined) test within a large test suite has corrupted the original
configuration for the `ApplicationContext`.
* `@Sql` now supports execution of _inlined SQL statements_ via a new
`statements` attribute.
* The JDBC XML namespace supports a new `database-name` attribute in
`<jdbc:embedded-database>`, allowing developers to set unique names
for embedded databases - for example, via a SpEL expression or a