[英]Error creating bean with name 'liquibase' in Spring Boot App
I have difficulties with adding Liquibase to my existing Spring Boot application.我很难将 Liquibase 添加到我现有的 Spring 引导应用程序中。
I added the necessary dependency in pom.xml.我在 pom.xml 中添加了必要的依赖项。 Then I have added an empty changelog-master.xml file Here is the code:
然后我添加了一个空的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"> http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
But when I run the program I got an exception:但是当我运行程序时,我遇到了一个异常:
Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed;在 class 路径资源 [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class] 中定义名称为“liquibase”的 bean 创建错误:调用 init 方法失败; nested exception is liquibase.exception.ChangeLogParseException: Error Reading Migration File: class path resource [db/changelog/changelog-master.xml] cannot be resolved to URL because it does not exist
嵌套异常是 liquibase.exception.ChangeLogParseException: Error Reading Migration File: class 路径资源 [db/changelog/changelog-master.xml] 无法解析为 URL 因为它不存在
Could anyone suggest some actions?有人可以建议一些行动吗?
you should add path to your changelog file in application.yml您应该在 application.yml 中添加更改日志文件的路径
for example:例如:
spring:
liquibase:
change-log: classpath:db/changelog/db.changelog-master.xml
and you should create valid empty changelog:你应该创建有效的空变更日志:
<?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.