@Retention(value=RUNTIME)
@Target(value={TYPE,METHOD,FIELD})
@Documented
public @interface Order
@Order
は、アノテーション付きコンポーネントのソート順を定義します。value()
はオプションであり、Ordered
インターフェースで定義されたオーダー値を表します。値が小さいほど優先順位が高くなります。デフォルト値は Ordered.LOWEST_PRECEDENCE
で、最低の優先度を示します(他の指定されたオーダー値に負けます)。
Spring 4.1 以降、標準の Priority
EE アノテーションをこのアノテーションのドロップイン置換として使用できます。
注 : アノテーションベースの順序付けは、特定の種類のコンポーネント(アノテーションベースの AspectJ アスペクトなど)でのみサポートされています。一方、Spring コンテナー内の順序付け戦略は、プログラムで構成可能な各インスタンスの順序付けを可能にするために、通常 Ordered
インターフェースに基づいています。
非順序オブジェクトのソートセマンティクスの詳細については、OrderComparator
の Javadoc を参照してください。
Ordered
, AnnotationAwareOrderComparator
, OrderUtils
, Priority
EE修飾子と型 | オプションの要素と説明 |
---|---|
int | value オーダー値。 |
public abstract int value
デフォルトは Ordered.LOWEST_PRECEDENCE
です。
Ordered.getOrder()