[英]Error creating bean with name 'liquibase' in Spring Boot App
我很難將 Liquibase 添加到我現有的 Spring 引導應用程序中。
我在 pom.xml 中添加了必要的依賴項。 然后我添加了一個空的changelog-master.xml文件這是代碼:
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
但是當我運行程序時,我遇到了一個異常:
在 class 路徑資源 [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class] 中定義名稱為“liquibase”的 bean 創建錯誤:調用 init 方法失敗; 嵌套異常是 liquibase.exception.ChangeLogParseException: Error Reading Migration File: class 路徑資源 [db/changelog/changelog-master.xml] 無法解析為 URL 因為它不存在
有人可以建議一些行動嗎?
您應該在 application.yml 中添加更改日志文件的路徑
例如:
spring:
liquibase:
change-log: classpath:db/changelog/db.changelog-master.xml
你應該創建有效的空變更日志:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
</databaseChangeLog>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.