Skip to content

Commit f46130e

Browse files
authored
Fixed bug mentioned in spring-projects#6762
The whole hierarchy should be searched when SearchStrategy.PARENTS is also used Fixes spring-projectsgh-6762
1 parent a985a5c commit f46130e

File tree

1 file changed

+2
-1
lines changed
  • spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition

1 file changed

+2
-1
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ private List<String> getMatchingBeans(ConditionContext context,
132132
return Collections.emptyList();
133133
}
134134
List<String> beanNames = new ArrayList<String>();
135-
boolean considerHierarchy = beans.getStrategy() == SearchStrategy.ALL;
135+
boolean considerHierarchy = beans.getStrategy() == SearchStrategy.ALL
136+
|| beans.getStrategy() == SearchStrategy.PARENTS;
136137
for (String type : beans.getTypes()) {
137138
beanNames.addAll(getBeanNamesForType(beanFactory, type,
138139
context.getClassLoader(), considerHierarchy));

0 commit comments

Comments
 (0)