diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/ConditionalOnMissingFilterBean.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/ConditionalOnMissingFilterBean.java index 81c8334f8d4..c69d2deeb98 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/ConditionalOnMissingFilterBean.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/ConditionalOnMissingFilterBean.java @@ -37,7 +37,24 @@ import org.springframework.core.annotation.AliasFor; * {@link FilterRegistrationBean}. *
* When placed on a {@code @Bean} method, the bean class defaults to the return type of - * the factory method: + * the factory method or the type of the {@link Filter} if the bean is a + * {@link FilterRegistrationBean}: + * + *
+ * @Configuration + * public class MyAutoConfiguration { + * + * @ConditionalOnMissingFilterBean + * @Bean + * public MyFilter myFilter() { + * ... + * } + * + * }+ *
+ * In the sample above the condition will match if no bean of type {@code MyFilter} or
+ * {@code FilterRegistrationBean