【问题标题】:The elements [spring.liquibase.username] were left unbound元素 [spring.liquibase.username] 未绑定
【发布时间】:2021-10-28 17:41:35
【问题描述】:

我在 Spring Boot 项目中添加了 Liquibase 配置:

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

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

【问题讨论】:

    标签: spring spring-boot liquibase


    【解决方案1】:

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

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

    spring:
        liquibase:
             user: root
    

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

    【讨论】:

      猜你喜欢
      • 2019-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多