Merge branch '2.7.x' into 3.0.x

Closes gh-35933
This commit is contained in:
Phillip Webb
2023-06-16 16:14:52 -07:00
2 changed files with 60 additions and 9 deletions

View File

@@ -162,7 +162,7 @@ class PropertiesMigrationReporterTests {
}
@Test
void mapPropertiesDeprecatedNoReplacement() throws IOException {
void mapPropertiesDeprecatedNoReplacement() {
this.environment.getPropertySources()
.addFirst(
new MapPropertySource("first", Collections.singletonMap("custom.map-no-replacement.key", "value")));
@@ -173,7 +173,7 @@ class PropertiesMigrationReporterTests {
}
@Test
void mapPropertiesDeprecatedWithReplacement() throws IOException {
void mapPropertiesDeprecatedWithReplacement() {
this.environment.getPropertySources()
.addFirst(new MapPropertySource("first",
Collections.singletonMap("custom.map-with-replacement.key", "value")));
@@ -205,6 +205,14 @@ class PropertiesMigrationReporterTests {
.contains("Replacement: custom.the-map-replacement.key");
}
@Test // gh-35919
void directCircularReference() {
this.environment.getPropertySources()
.addFirst(new MapPropertySource("backcompat", Collections.singletonMap("wrong.two", "${test.two}")));
createAnalyzer(loadRepository("metadata/sample-metadata.json")).getReport();
assertThat(this.environment.getProperty("test.two")).isNull();
}
private List<String> mapToNames(PropertySources sources) {
List<String> names = new ArrayList<>();
for (PropertySource<?> source : sources) {