spring-projects / spring-projects/spring-modulith

Module-scoped Flyway migrations fail to resolve in GraalVM Native Image

Open
#1,751 2 comments 1 reaction 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Jun 22, 2026.

in: runtime meta: investigating type: bug
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
  1. Clone the reproduction repository.
  2. Compile the native binary using ./gradlew nativeCompile.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.