@Target(value={TYPE,METHOD})
@Retention(value=RUNTIME)
@Documented
@ConditionalOnMissingBean(parameterizedContainer=org.springframework.boot.web.servlet.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 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.
| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.Class<? extends javax.servlet.Filter>[] |
value
The filter bean type that must not be present.
|
@AliasFor(annotation=ConditionalOnMissingBean.class) public abstract java.lang.Class<? extends javax.servlet.Filter>[] value