SpringBoot集成Liquibase启动报错:无法找到支持true的解析器
问题分析
核心错误为 liquibase.exception.UnknownChangelogFormatException: Cannot find parser that supports true,说明Spring Boot初始化Liquibase时,读取到的changelog配置是布尔值true,而非合法的changelog文件路径(如yaml/xml/sql格式的文件路径)。
解决方案
修正Liquibase配置项
打开项目的application.properties或application.yml配置文件,找到Liquibase相关配置:- 若为properties格式,确保
spring.liquibase.change-log指向具体文件路径,示例:spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.yaml - 若为yml格式,修正配置如下:
spring: liquibase: change-log: classpath:db/changelog/db.changelog-master.yaml
注意:控制Liquibase启用/禁用需用
spring.liquibase.enabled=true/false,不要将change-log设为布尔值。- 若为properties格式,确保
确认changelog文件存在
确保配置中指定的changelog文件存在于src/main/resources对应目录下,文件格式符合Liquibase要求(支持yaml、xml、sql、json)。检查依赖兼容性(可选)
当前使用Spring Boot 3.0.5 + Liquibase 4.17.2版本兼容,若问题仍存在,可尝试升级Liquibase到适配Spring Boot 3.x的版本,例如在pom.xml中调整:<dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> <version>4.20.0</version> </dependency>验证配置语法
检查配置文件是否存在语法错误,比如yml文件的缩进问题、properties文件的键值对格式错误。
内容的提问来源于stack exchange,提问作者Developer
相关产品推荐
相关产品推荐

