Priority class

Ranks a bean among others of the same type: the JSR-250 annotation jakarta.annotation.Priority, on a bean class (or @Bean method).

It does two jobs. Among several candidates for an injection point or a getBean<T>() without a primary or name match, the one with the lowest value wins (two with that value are ambiguous). And it orders beans in collections and listeners when they have neither Ordered nor @Order, like Spring's AnnotationAwareOrderComparator. @Primary() and @Order cover the same needs in Spring style.

import 'package:spring_core_dart/jakarta.dart' as jakarta;

@Component()
@jakarta.Priority(1)
class FastStore implements Store { ... }

@Component()
@jakarta.Priority(5)
class SlowStore implements Store { ... }
// Store is FastStore; List<Store> is [FastStore, SlowStore].

Spring (Java):

@Component @Priority(1) class FastStore implements Store { ... }

Constructors

Priority(int value)
Gives the bean the priority value; lower values come first.
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
value → int
The priority; lower values win and sort first.
final

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