spring-boot - Flyway 通配符在 Spring Boot 中不起作用
问题描述
我收到以下错误:
Flyway failed to initialize: none of the following migration scripts locations could be found:
- classpath:db/*/migrations/
这是目录结构的样子:
这就是我尝试过的:
# examples, obviously I tried these independently from each other
spring:
flyway:
# these work:
locations: "classpath:db"
locations: "classpath:db/release_1.0/migrations/"
# these don't work: (I am getting the same error as shown above)
locations: "classpath:db/**/migrations/"
locations: "classpath:db/release*/migrations/"
locations: "classpath:db/*/migrations/"
但它们应该根据6.4 版的这篇博文工作。(我没有看到他们已将其删除)
我正在使用spring-boot-starter-parent
2.4.1
,所以它是Flyway 7.1.1
。
谁能向我解释如何在 Flyway 中使用通配符指定迁移文件夹,为什么它不起作用?
解决方案
随着 Flyway 的位置支持已经发展到支持通配符、云存储等,如本期所述,Spring Boot 准确检查位置的能力有所下降。因此,对位置检查的支持在 Spring Boot 2.5 中被弃用,并且在弃用期之后,它将被完全删除。同时,您可以通过设置spring.flyway.check-location
将其关闭false
。
推荐阅读
- python - 如何通过别名在 Linux 中将默认的 python3 设置为 python3.9?
- centos - 在 CentOS 8 上无法找到并安装 ImageMagick
- javascript - 如何使用 React 创建自动增长收缩输入?
- task - 为什么我的 leetcode 任务不是从数字 1 开始的?
- javascript - Promise.resolve() 什么时候触发 then() 方法?
- javascript - 为什么 React 源代码是用 JavaScript 而不是 TypeScript 编写的,但仍然有类型?
- swift - 如果默认设置为 true,为什么我需要设置 Analytics.setAnalyticsCollectionEnabled(true)?Firebase + iOS
- sql - 查询以显示类似的项目组,其中包含单个主要项目和多个用逗号分隔的组项目
- python - 从 SFTP 服务器读取图像 EXIF 数据而不下载文件
- javascript - 使用 javascript selenium 清除和发送密钥