Closed
Description
Phil Webb opened SPR-16213 and commented
It wasn't immediately obvious to me that @Order
can be used on @Bean
methods to change the order of Collection<BeanType>
injection.
Some dedicated section of the reference documentation explaining @Order
and the difference between @DependsOn
could be useful. It might also be worth adding a note to the Javadoc (although technically @Order
is in core so it shouldn't know about context concerns).
Here's an example stack overflow question with someone else asking the question and a slightly misleading answer:
https://stackoverflow.com/questions/36187063/instantiate-beans-in-order-in-spring
Issue Links:
- @Order should get detected in case of proxyTargetClass=false as well [SPR-12636] #17237
@Order
should get detected in case of proxyTargetClass=false as well - @Order annotations not consistently honored within DispatcherServlet and other parts of the framework [SPR-12806] #17403
@Order
annotations not consistently honored within DispatcherServlet and other parts of the framework - Autowiring should support ordered collection driven by Order annotation or Ordered interface [SPR-5574] #10245 Autowiring should support ordered collection driven by Order annotation or Ordered interface
- Add support for @javax.annotation.Priority as alternative to @Primary [SPR-10548] #15179 Add support for
@javax
.annotation.Priority as alternative to@Primary
- Support for @Order at the @Bean method level [SPR-11310] #15934 Support for
@Order
at the@Bean
method level
Referenced from: commits 84699c8, 1d060ec
Backported to: 4.3.13