-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
The flyway auto-configuration in Spring Boot has the very nice feature of replacing {vendor}
in any spring.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#L361
On 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 to Sql.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.