简体   繁体   English

在 Spring 引导应用程序中创建名为“liquibase”的 bean 时出错

[英]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.

相关问题 创建名为“Liquibase”的 Bean 时出错 - Error Creating Bean with Name 'Liquibase' Spring 引导错误创建名称为错误的 bean - Spring boot Error creating bean with name Error Spring Boot 错误创建名为“optionalLiveReloadServer”的bean - Spring Boot Error creating bean with name 'optionalLiveReloadServer' Spring Boot:创建名为“springSecurityFilterChain”的 bean 时出错 - Spring Boot: Error creating bean with name 'springSecurityFilterChain' Spring 引导:创建名为“persistenceExceptionTranslationPostProcessor”的 bean 时出错 - Spring boot : Error creating bean with name 'persistenceExceptionTranslationPostProcessor' Spring Boot:创建名称为&#39;methodValidationPostProcessor&#39;的bean时出错 - Spring boot : Error creating bean with name 'methodValidationPostProcessor' Spring Boot“使用名称创建bean时出错” - Spring Boot "Error creating bean with name" 创建名为“requestMappingHandlerAdapter”的 bean 时出错 Spring Boot - Error creating bean with name 'requestMappingHandlerAdapter' Spring Boot 尝试运行Spring Boot应用程序时出错。 创建名称为bean的错误 - Error trying to run Spring boot app. Error creating bean with name 具有Spring Security的Spring Boot:创建名称为&#39;securityConfiguration&#39;的bean时出错 - Spring boot with spring security: Error creating bean with name 'securityConfiguration'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM