我将 Liquibase 配置添加到 Spring Boot 项目中:
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
中的用户/密码属性。完整部分,只需保留 changeLog
和dropFirst
那里。
关于spring - 元素 [spring.liquibase.username] 未绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68976174/