Document common use cases for @Order vs @Priority vs @DependsOn [SPR-16213] #20761
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: task
A general task
Milestone
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 ofCollection<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@Order
annotations not consistently honored within DispatcherServlet and other parts of the framework@javax
.annotation.Priority as alternative to@Primary
@Order
at the@Bean
method levelReferenced from: commits 84699c8, 1d060ec
Backported to: 4.3.13
The text was updated successfully, but these errors were encountered: