Order class

An annotation that gives a bean (or a @Bean method, an event listener method) its place when several are run or injected in turn; lower values come first.

It is the usual way to order: listeners, runners and the elements of an injected List<T> follow it, and beans without any order (no @Order, Ordered or jakarta @Priority) go last. When the bean's class also implements Ordered, the interface value wins over an @Order on the class; an @Order on a @Bean method wins over both.

@Component()
@Order(1)
class FirstHandler implements Handler {}

// Injected `List<Handler>` has FirstHandler before unordered handlers.

Spring (Java):

@Component
@Order(1)
class FirstHandler implements Handler {}

Constructors

Order([int value = Ordered.lowestPrecedence])
Gives the order value; Ordered.lowestPrecedence when left out, like Spring's @Order.
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 order value; lower values come 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