Support property placeholders in @Sql script paths
Prior to this commit, paths configured via the scripts attribute in
@Sql were required to be final paths without dynamic placeholders;
however, being able to make script paths dependent on the current
environment can be useful in certain testing scenarios.
This commit introduces support for property placeholders (${...}) in
@Sql script paths which will be replaced by properties available in
the Environment of the test's ApplicationContext.
Closes gh-33114
This commit is contained in:
@@ -122,6 +122,9 @@ classpath resource (for example, `"/org/example/schema.sql"`). A path that refer
|
||||
URL (for example, a path prefixed with `classpath:`, `file:`, `http:`) is loaded by using
|
||||
the specified resource protocol.
|
||||
|
||||
As of Spring Framework 6.2, paths may contain property placeholders (`${...}`) that will
|
||||
be replaced by properties stored in the `Environment` of the test's `ApplicationContext`.
|
||||
|
||||
The following example shows how to use `@Sql` at the class level and at the method level
|
||||
within a JUnit Jupiter based integration test class:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user