Annotation Interface ConditionalOnMissingFilterBean
@Target({TYPE,METHOD})
@Retention(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.
- Since:
- 2.1.0
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
@AliasFor(annotation=ConditionalOnMissingBean.class) Class<? extends jakarta.servlet.Filter>[] valueThe filter bean type that must not be present.- Returns:
- the bean type
- Default:
- {}
-