From fd97066604a42d1c598f8069c443bbea9e4c13c7 Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Tue, 30 Apr 2019 16:19:18 -0700 Subject: [PATCH] Use MergedAnnotation.getRoot() method Closes gh-16661 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- .../properties/ConfigurationPropertiesScanRegistrar.java | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) 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()); } }