@Target(value={TYPE,METHOD}) @Retention(value=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
register 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
.
@AliasFor(annotation=ConditionalOnMissingBean.class) public abstract Class<? extends javax.servlet.Filter>[] value
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.