0

I have been working with some of the spring properties mentioned here: application-properties

In particular, the liquibase properties.

In my yml file, if I use yml's tree-like syntax:

spring:
  liquibase:
    change-log: classpath:/db/changelog/db.changelog-master-test-h2.yml

Spring doesn't pick up the value. (More specifically, Spring's org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties class doesn't pick up the value)

But if I use "property file" syntax:

spring.liquibase.change-log: my-path

Spring does pick up the value.

I was under the impression that in the Spring framework, the 2 syntaxes were interchangeable, but apparently not.

What is going on here?

NOTE: I have tried these variations.

These work:

spring.liquibase.change-log: classpath:/db/changelog/db.changelog-master-test-h2.yml

spring.liquibase.changeLog: classpath:/db/changelog/db.changelog-master-test-h2.yml

These do not work:

spring:
  liquibase:
    change-log: classpath:/db/changelog/db.changelog-master-test-h2.yml

spring:
  liquibase:
    changeLog: classpath:/db/changelog/db.changelog-master-test-h2.yml

full contents of my application.yml

---

spring.profile: h2


spring:
  datasource:
    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
    driver-class-name: org.h2.Driver
  jpa:
    database: h2
    hibernate:
      ddl-auto: none
    properties:
      hibernate:
        dialect: org.hibernate.dialect.H2Dialect
        format_sql: true
    show-sql: true
  liquibase:
    enabled: true
    # change-log: classpath:/db/changelog/db.changelog-master-test-h2.yaml
    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
    default-schema: PUBLIC

spring.liquibase.change-log: classpath:/db/changelog/db.changelog-master-test-h2.yaml
StvnBrkdll
  • 3,924
  • 1
  • 24
  • 31
  • Have you tried `changeLog` instead of `change-log` not sure if a `-` is allowed in a yml file when used like that. All in all it should work (unless SnakeYaml doesn't parse it correctly). – M. Deinum Dec 23 '18 at 15:08
  • change-log is the correct syntax. – StvnBrkdll Dec 23 '18 at 15:59
  • `change-log` and `changeLog` are for Spring Boot the same. However I’m doubting that using `change-log` is valid when using indented yaml. Hence the suggestion to use `changeLog`. – M. Deinum Dec 23 '18 at 16:05
  • @M.Deinum Thx for your response. I tried your suggestion (changing "-" syntax to camel-case). Your observation is correct in that the parser appears to accept both. However after your suggested change, the "tree-syntax" still fails to initialize the property, while the "properties" syntax does successfully initialize the property. – StvnBrkdll Dec 23 '18 at 16:10
  • The parser will accept both, it is relaxed in that regard, using an `_` would also work. Weird as it should simply work. Can you add the full content of your `application.yml` – M. Deinum Dec 23 '18 at 19:01

0 Answers0