元素 [spring.liquibase.username] 未绑定

The elements [spring.liquibase.username] were left unbound

我将 Liquibase 配置添加到 Spring 启动项目:

spring:
  application:
    name: test-service
  profiles:
    active: dev
  data:
    web:
      pageable:
        one-indexed-parameters: true # Fix pagination starting number to start from 1
  jackson:
    default-property-inclusion: non_null
  jmx:
    enabled: false
  datasource:
    platform: org.hibernate.dialect.PostgreSQL95Dialect
    url: jdbc:postgresql://123.123.123.123:5432/test
    driverClassName: org.postgresql.Driver
    username: root
    password: test
  liquibase:
    url: jdbc:postgresql://123.123.123.123:5432/test
    driverClassName: org.postgresql.Driver
    username: root
    password: test
    changeLog: "classpath:db.changelog-master.yaml"
    dropFirst: false
  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true
    database: postgresql

当我启动应用程序时出现此错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Binding to target [Bindable@5ec391f6 type = org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties, value = 'provided', annotations = array<Annotation>[@org.springframework.boot.context.properties.ConfigurationProperties(ignoreInvalidFields=false, ignoreUnknownFields=false, prefix=spring.liquibase, value=spring.liquibase)]] failed:

    Property: spring.liquibase.username
    Value: root
    Origin: class path resource [application.yml] - 36:15
    Reason: The elements [spring.liquibase.username] were left unbound.

Action:

Update your application's configuration

你知道我该如何解决这个问题吗?

发件人:https://docs.liquibase.com/tools-integrations/springboot/springboot.html

没有属性spring.liquibase.username,您应该尝试将您的application.yml相关条目更新为:spring.liquibase.user

spring:
    liquibase:
         user: root

但是,由于您对数据库连接使用相同的用户名,我认为您可以完全省略 .liquibase 部分中的 user/password 属性,只需保留 changeLogdropFirst那里。