Annotation Interface Primary


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface Primary
Indicates that a bean marked with this annotation is the primary candidate when multiple beans of the same type are available for autowiring or injection.

This annotation can be applied to a class or a method within a class to specify it as the primary choice for dependency resolution.

When multiple beans of the same type are available, the one annotated with @Primary will be given precedence for injection or autowiring. It serves as the default choice when the bring framework needs to resolve the ambiguity between multiple candidates of the same type.

Since:
1.0
Author:
Blyzhnytsia Team