When running a Spring Modulith application on a standard JVM, module-scoped Flyway migrations are automatically routed and executed correctly from their respective module paths (e.g., db/migration/order/).
However, when compiled into a GraalVM Native Image, the dynamic resource routing mechanism breaks. Instead of scanning the module-scoped directory, Flyway defaults back to scanning the root directory (db/migration/), resulting in a application startup failure because the migration files cannot be located.
Environment
- Java Version: Java 25 (Oracle GraalVM 25.0.3)
- Frameworks: Spring Boot 4.1.0, Spring Modulith 2.1.0
- Database: H2 (In-Memory)
Minimal Reproduction
A self-contained reproduction repository with an automated GitHub Actions validation workflow can be found here:
https://github.com/rivon0507/modulith-flyway-native/
Steps to Reproduce
- Clone the reproduction repository.
- Compile the native binary using ./gradlew nativeCompile.
- Run the generated native executable.
Expected Behavior
Flyway should resolve and execute migrations from the module-scoped path (db/migration/order/).
Actual Behavior
The application crashes at startup with a FlywayException because it searches for the migration scripts directly under the root db/migration/ path instead of the module subfolder.
When running a Spring Modulith application on a standard JVM, module-scoped Flyway migrations are automatically routed and executed correctly from their respective module paths (e.g., db/migration/order/).
However, when compiled into a GraalVM Native Image, the dynamic resource routing mechanism breaks. Instead of scanning the module-scoped directory, Flyway defaults back to scanning the root directory (db/migration/), resulting in a application startup failure because the migration files cannot be located.
Environment
Minimal Reproduction
A self-contained reproduction repository with an automated GitHub Actions validation workflow can be found here:
https://github.com/rivon0507/modulith-flyway-native/
Steps to Reproduce
Expected Behavior
Flyway should resolve and execute migrations from the module-scoped path (db/migration/order/).
Actual Behavior
The application crashes at startup with a FlywayException because it searches for the migration scripts directly under the root db/migration/ path instead of the module subfolder.