-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support property placeholders in @Sql
script paths
#33114
Comments
{vendor}
replacement in @Sql annotation{vendor}
replacement in @Sql
annotation
{vendor}
replacement in @Sql
annotation@Sql
script paths
Hi @kistlers, Congratulations on submitting your first issue for the Spring Framework! 👍 That's an interesting idea. Unfortunately, the Thus, we cannot rely on that within the In addition, we do not intend to introduce any comparable functionality within the core Spring Framework. Instead, we recommend the use of bean definition profiles for controlling which The only piece of the puzzle missing is the ability to use property placeholders ( In light of that, I've decided to repurpose this issue to address that shortcoming. You can view a proof of concept here: main...sbrannen:spring-framework:issues/gh-33114-placeholders-in-Sql-script-paths There you can see a |
@Sql
script paths@Sql
script paths
Thanks, that works for me! |
The flyway auto-configuration in Spring Boot has the very nice feature of replacing
{vendor}
in anyspring.flyway.locations
path with database-specific values to support multiple databases easily.The code for those replacements is in
FlywayAutoConfiguration.LocationResolver
: https://github.com/spring-projects/spring-boot/blob/70a5dc64f6b4160ec9c20d48d84a0869ef735df8/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java#L361On the other hand, we have the convenient
@Sql
annotation to run SQL scripts before tests are running. It would be very nice, if{vendor}
could also be part of those paths given toSql.scripts
with the same replacement logic as flyway.I have a specific use case for that: Currently, we have two systems in place at our company (a shared library and a dedicated application) that are built to run on multiple database systems (Postgres, MySQL, MariaDB, and HsqlDB). We have set up maven, such that some tests are run multiple times with different databases in test containers using multiple maven-surefire-plugin executions. It would be great if I could still make use of the @SQL annotation in that case with the vendor replacement.
The text was updated successfully, but these errors were encountered: