Skip to content

Commit 59b1df4

Browse files
committed
Polish "Look in correct context when finding Liquibase beans"
See gh-22681
1 parent 6215681 commit 59b1df4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ void liquibaseReportIsReturned() {
6262
});
6363
}
6464

65+
@Test
66+
void liquibaseReportIsReturnedForContextHierarchy() {
67+
this.contextRunner.withUserConfiguration().run((parent) -> {
68+
this.contextRunner.withUserConfiguration(Config.class).withParent(parent).run((context) -> {
69+
Map<String, LiquibaseBean> liquibaseBeans = context.getBean(LiquibaseEndpoint.class).liquibaseBeans()
70+
.getContexts().get(parent.getId()).getLiquibaseBeans();
71+
assertThat(liquibaseBeans.get("liquibase").getChangeSets()).hasSize(1);
72+
});
73+
});
74+
}
75+
6576
@Test
6677
void invokeWithCustomSchema() {
6778
this.contextRunner.withUserConfiguration(Config.class)

0 commit comments

Comments
 (0)