-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Flyway auto-configuration does not work with Flyway 10 when using GraalVM #40821
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
Flyway auto-configuration does not work with Flyway 10 when using GraalVM #40821
Conversation
2. Add test for flyway10 case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @MazizEsa.
In addition to my comment about avoiding reflection with Flyway 9. FlywayAutoConfiguration.FlywayAutoConfigurationRuntimeHints
also needs to be updated to allow a Scanner
instance to be created reflectively when using Flyway 10. This reflection hint should only be registered when a class that only exists in Flyway 10 is on the classpath.
Constructor<?> scannerConstructor; | ||
Scanner scanner; | ||
try { | ||
scannerConstructor = ClassUtils.forName("org.flywaydb.core.internal.scanner.Scanner", null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to avoid reflection in the default case when using Flyway 9.
One way to do that would be to catch the NoSuchMethodError
and then fall back to reflection. That fallback could even just assume that it's Flyway 10 and assume that Scanner
will take 5 constructor arguments.
…lyway10 via reflection.
Thank you, @MazizEsa, and congratulations on making your first contribution to Spring Boot. |
Thanks @wilkinsona for polishing up. My apologies towards the end, I got busier with my work, hence slower in the implementation. |
In summary added compatibility with flyway 10 using reflection when initializing flyway scanner.
Add mechanism to check the dependency based on the mentioned flyway versions.
For #38923