defaultCandidate property

bool defaultCandidate
final

Whether the bean is injected where only its type is asked for. With false it is injected only where a qualifier (@Qualifier, the bean name or an alias) selects it, and @ConditionalOnBean / @ConditionalOnMissingBean ignore it. Use it for a second bean of a common type that must not get in the way of the main one (Spring 6.2's @Bean(defaultCandidate = false)).

// Only injected where @Qualifier('audit') asks for it.
@Bean(defaultCandidate: false)
@Qualifier('audit')
Executor auditExecutor() => Executor.single();

Implementation

final bool defaultCandidate;