diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml
index 1c9379c1a73..dddb10dbe44 100644
--- a/spring-boot-project/spring-boot-dependencies/pom.xml
+++ b/spring-boot-project/spring-boot-dependencies/pom.xml
@@ -179,7 +179,7 @@
1.24
8.0.0
- 5.2.0.M1
+ 5.2.0.BUILD-SNAPSHOT
2.2.0.M1
4.2.0.M1
2.0.5.RELEASE
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesScanRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesScanRegistrar.java
index f17317e6793..0e1c45da36a 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesScanRegistrar.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesScanRegistrar.java
@@ -114,11 +114,8 @@ class ConfigurationPropertiesScanRegistrar
.from(type, MergedAnnotations.SearchStrategy.EXHAUSTIVE)
.get(Component.class);
if (component.isPresent()) {
- MergedAnnotation> parent = component;
- while (parent.getParent() != null) {
- parent = parent.getParent();
- }
- throw new InvalidConfigurationPropertiesException(type, parent.getType());
+ throw new InvalidConfigurationPropertiesException(type,
+ component.getRoot().getType());
}
}