Merge branch '3.4.x'

Closes gh-45384
This commit is contained in:
Stéphane Nicoll
2025-05-07 10:38:28 +02:00
4 changed files with 19 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,6 +58,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
* @author Scott Frederick
* @author Yanming Zhou
*/
class PropertyDescriptorResolverTests {
@@ -79,9 +80,13 @@ class PropertyDescriptorResolverTests {
.map((descriptor) -> descriptor.getGetter().getEnclosingElement().getSimpleName().toString()))
.containsExactly("HierarchicalProperties", "HierarchicalPropertiesParent",
"HierarchicalPropertiesParent");
assertThat(resolver.resolve(type, null)
List<ItemMetadata> itemMetadataList = resolver.resolve(type, null)
.map((descriptor) -> descriptor.resolveItemMetadata("test", metadataEnv))
.map(ItemMetadata::getDefaultValue)).containsExactly("three", "two", "one");
.toList();
assertThat(itemMetadataList).map(ItemMetadata::getDefaultValue)
.containsExactly("three", "two", "one");
assertThat(itemMetadataList).map(ItemMetadata::getDescription)
.containsExactly("Concrete property.", "Parent property.", "Grandparent property.");
});
}

View File

@@ -26,6 +26,9 @@ import org.springframework.boot.configurationsample.ConfigurationProperties;
@ConfigurationProperties("hierarchical")
public class HierarchicalProperties extends HierarchicalPropertiesParent {
/**
* Concrete property.
*/
private String third = "three";
public String getThird() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@ package org.springframework.boot.configurationsample.simple;
*/
public abstract class HierarchicalPropertiesGrandparent {
/**
* Grandparent property.
*/
private String first = "one";
public String getFirst() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@ package org.springframework.boot.configurationsample.simple;
*/
public abstract class HierarchicalPropertiesParent extends HierarchicalPropertiesGrandparent {
/**
* Parent property.
*/
private String second = "two";
public String getSecond() {