无法通过spring.flyway.enabled禁用飞行通道



我使用flyway作为本地配置文件来填充用于集成测试的数据库。

application.yml:

spring:
(...)
flyway.enabled: false

application-local.yml:

spring:
(...)
flyway:
enabled: true
license-key: (...)
locations: classpath:mssql/migrations

预期:

应用程序在启动过程中不会尝试使用配置文件dev自动配置飞行通道

实际:

The following profiles are active: dev
(...)
org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:
(...)
Factory method 'flyway' threw exception; nested exception is org.springframework.boot.autoconfigure.flyway.FlywayMigrationScriptMissingException: 
Cannot find migration scripts in: [classpath:db/migration] (please add migration scripts or check your Flyway configuration)

版本:

天桥核心6.3.1弹簧套2.2.5

您指定了application-local.yml,这意味着您指定了local配置文件,但您使用dev配置文件运行应用程序。有两个潜在问题:

  1. 您使用错误的配置文件运行应用程序:应该是local,而不是dev
  2. 或者dev中没有包含local配置文件https://docs.spring.io/spring-boot/docs/1.1.6.RELEASE/reference/html/boot-features-profiles.html

最新更新