Primary class

Makes this bean the one injected when several beans have the requested type.

Without it, asking for a type that two beans have is an error. Mark the usual implementation @Primary() and inject the others by Qualifier where they are wanted.

@Component()
@Primary()
class EnglishGreeter implements Greeter { ... }

@Component()
class FrenchGreeter implements Greeter { ... }

// context.getBean<Greeter>() returns the EnglishGreeter.

Spring (Java):

@Component
@Primary
class EnglishGreeter implements Greeter { ... }

Constructors

Primary()
Marks the bean as primary.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited