renke
renke

Reputation: 1230

Disable Flyway on Spring Boot 2

I've been trying to disable Flyway for my unit tests on Spring Boot 2, but could not succeed.

I understand, from Spring Boot's documentation, that the property for doing so changed from flyway.enabled to spring.flyway.enabled, and added that to my test application profile (as below).

spring:
  datasource:
    url: jdbc:h2:mem:db
  jpa:
    hibernate:
      ddl-auto: create
  flyway:
    enabled: false

This configuration appears to have no effect at all, and Flyway auto-configuration is still invoked.

I also tried creating a separate auto-configuration class for the unit tests only, where I added @EnableAutoConfiguration(exclude = FlywayAutoConfiguration.class), but this try failed as much as the previous one.

Upvotes: 11

Views: 11796

Answers (3)

Alex
Alex

Reputation: 627

Add

spring.flyway.enabled=false

To application.properies

Upvotes: 1

Fabio De Carli
Fabio De Carli

Reputation: 379

I use spring-boot 2.0.3-RELEASE and add JVM option -Dspring.flyway.enabled=false

Upvotes: 0

Mac
Mac

Reputation: 340

It's because you have jpa.hibernate.ddl-auto set to create. Set it to none instead. Otherwise, flyway.enabled has no effect.

Upvotes: 2

Related Questions