spring-projects / spring-projects/spring-modulith
Module-scoped Flyway migrations fail to resolve in GraalVM Native Image
@odrotbohm is already working on this.
Since Jun 22, 2026.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.