4 Answers
4

This answer works with Spring 1.X version. If you are looking for answer for Spring 2.X, you should see the below answer.

There is a property available for spring-boot to disable flyway if it's needed flyway.enabled which is true by default.

You can have a profile specific configuration, in your case it should be named as application-test.yml. This configuration can disable flyway if profile is active. You just have to declare it as follows:

flyway:
enabled: false

And if you specify test profile in common configuration, just add it to it's root.

Update: To disable flyway in a specific profile, you can put that property in the properties file specific to that profile. For instance, if your profile is called "abc", you can put it in application-abc.properties. Check out Spring's documentation on Profile-specific properties for more clarity on how to name the files. Generally, the format is application-{profileName}.properties.