Annotation Interface ConditionalOnMissingFilterBean
@Target({TYPE,METHOD})
@Retention(RUNTIME)
@Documented
@ConditionalOnMissingBean(parameterizedContainer=FilterRegistrationBean.class)
public @interface 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 through 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
-
Element Details
-
value
The filter bean type that must not be present.- Returns:
- the bean type
- Default:
- {}
-