From 058428a14cbeb5ff02ecb80a3c59f92e2e97a7b5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 23 Nov 2018 15:44:58 +0000 Subject: [PATCH] Clarify how multiple attributes are treated by ConditionalOn(Missing)Bean Closes gh-15177 --- .../boot/autoconfigure/condition/ConditionalOnBean.java | 5 +++-- .../autoconfigure/condition/ConditionalOnMissingBean.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java index 4606b77e160..6441b9c8f9f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java @@ -27,8 +27,9 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.context.annotation.Conditional; /** - * {@link Conditional} that only matches when beans of the specified classes and/or with - * the specified names are already contained in the {@link BeanFactory}. + * {@link Conditional} that only matches when beans meeting all the specified requirements + * are already contained in the {@link BeanFactory}. All the requirements must be met for + * the condition to match, but they do not have to be met by the same bean. *

* When placed on a {@code @Bean} method, the bean class defaults to the return type of * the factory method: diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java index be75081d1e5..ff0a042ab4b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java @@ -27,8 +27,9 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.context.annotation.Conditional; /** - * {@link Conditional} that only matches when no beans of the specified classes and/or - * with the specified names are already contained in the {@link BeanFactory}. + * {@link Conditional} that only matches when no beans meeting the specified requirements + * are already contained in the {@link BeanFactory}. None of the requirements must be met + * for the condition to match and the requirements do not have to be met by the same bean. *

* When placed on a {@code @Bean} method, the bean class defaults to the return type of * the factory method: