Annotation Type Order


@Retention(CLASS) @Target({TYPE,METHOD}) public @interface Order

Where a bean stands among the beans of its type: the lower the value, the earlier it comes in a List an injection point receives, and the earlier a SecurityFilterChain is asked whether a request is its own.

@Bean
@Order(1)
SecurityFilterChain api(HttpSecurity http) { ... }

@Bean
@Order(2)
SecurityFilterChain pages(HttpSecurity http) { ... }

A bean without one comes last, in the order the build found it. Beans with the same value keep that order among themselves. The order says nothing about which bean a single injection point receives -- that is @Primary and @Qualifier -- or about the order beans are constructed in.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The value that comes before every other.
    static final int
    The value of a bean that carries no @Order.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    The position: HIGHEST_PRECEDENCE comes first, LOWEST_PRECEDENCE last.
  • Field Details

    • HIGHEST_PRECEDENCE

      static final int HIGHEST_PRECEDENCE
      The value that comes before every other.
      See Also:
    • LOWEST_PRECEDENCE

      static final int LOWEST_PRECEDENCE
      The value of a bean that carries no @Order.
      See Also:
  • Element Details