Package org.springframework.context.annotation

# Annotation Interface Fallback

@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented public @interface Fallback
Indicates that a bean qualifies as a fallback autowire candidate. This is a companion and alternative to the `Primary` annotation.

If all beans but one among multiple matching candidates are marked as a fallback, the remaining bean will be selected.

Just like primary beans, fallback beans only have an effect when finding multiple candidates for single injection points. All type-matching beans are included when autowiring arrays, collections, maps, or ObjectProvider streams.

Since:
  6.2
Author:
  Juergen Hoeller
See Also:
  - `Primary`
  - `Lazy`
  - `Bean`
  - `BeanDefinition.setFallback(boolean)`