我使用 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)
flyway核心6.3.1 春季启动 2.2.5
您指定了
application-local.yml
,这意味着您指定了 local
配置文件,但您使用 dev
配置文件运行应用程序。有两个潜在问题:
local
而不是
dev
local
配置文件包含到 dev
https://docs.spring.io/spring-boot/docs/1.1.6.RELEASE/reference/html/boot-features-profiles.html 您的配置文件有错误:
应该是这样的:
春天: (...) 飞行路线: 启用:假