Annotation Type ConditionalOnMissingFilterBean


@Conditional that only matches when no Filter beans of the specified type are contained in the BeanFactory. This condition will detect both directly registered Filter beans as well as those registered via a FilterRegistrationBean.

When placed on a @Bean method, the bean class defaults to the return type of the factory method or the type of the Filter if the bean is a FilterRegistrationBean:

 @Configuration
 public class MyAutoConfiguration {

     @ConditionalOnMissingFilterBean
     @Bean
     public MyFilter myFilter() {
         ...
     }

 }

In the sample above the condition will match if no bean of type MyFilter or FilterRegistrationBean<MyFilter> is already contained in the BeanFactory.

Since:
2.1.0
Author:
Phillip Webb
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Filter>[]
    The filter bean type that must not be present.