From 408d5246bc807d15f6378442ca5794a11dd93165 Mon Sep 17 00:00:00 2001 From: Andrii Bohutskyi Date: Thu, 23 Mar 2023 11:34:05 +0200 Subject: [PATCH 1/2] Fix hint to include all Liquibase resources in default location See gh-34729 --- .../autoconfigure/liquibase/LiquibaseAutoConfiguration.java | 2 +- .../liquibase/LiquibaseAutoConfigurationTests.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index c6b65c50e3..d7d7026f47 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -175,7 +175,7 @@ public class LiquibaseAutoConfiguration { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - hints.resources().registerPattern("db/changelog/db.changelog-master.yaml"); + hints.resources().registerPattern("db/changelog/*"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index f61a139983..bcd2087848 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -423,8 +423,11 @@ class LiquibaseAutoConfigurationTests { void shouldRegisterHints() { RuntimeHints hints = new RuntimeHints(); new LiquibaseAutoConfigurationRuntimeHints().registerHints(hints, getClass().getClassLoader()); + assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/")).accepts(hints); assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/db.changelog-master.yaml")) .accepts(hints); + assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/tables/init.sql")) + .accepts(hints); } private ContextConsumer assertLiquibase(Consumer consumer) { From 03d42deaea8d4dafeb9339ddba5bb9580dd4a6c0 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 11 Apr 2023 16:02:09 +0200 Subject: [PATCH 2/2] Polish "Fix hint to include all Liquibase resources in default location" See gh-34729 --- .../liquibase/LiquibaseAutoConfigurationTests.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index bcd2087848..3b1e79102b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -426,8 +426,7 @@ class LiquibaseAutoConfigurationTests { assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/")).accepts(hints); assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/db.changelog-master.yaml")) .accepts(hints); - assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/tables/init.sql")) - .accepts(hints); + assertThat(RuntimeHintsPredicates.resource().forResource("db/changelog/tables/init.sql")).accepts(hints); } private ContextConsumer assertLiquibase(Consumer consumer) {