Order metadata to enforce appearance at the end of a sorted collection #34670
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Overview
I kindly want to ask to resume the conversation on this topic.
It seems, that people have to deal with this problem.
What is desired, is that assume we have 3 beans:
A
,B
andNoOp
. And I assemble them into aList
somewhere via:And what I want is the following:
The
NoOp
implementation is required to be the last, since it is fallback. But I really do not care about the order of other beans in theList
. What I want is to ensure, that theNoOp
bean is the last one in theList
.The problem is that simply adding
@Order
with the lowest priority to theNoOp
will not work.I can, of course, define the
@Order
with higher priority for each bean except forNoOp
, but this requires that every time a new implementation ofCommonInterface
being added, the developer must not forget about adding the corresponding order marker as well. Otherwise, theNoOp
may not be the last, which can lead and probably would lead to bugs.The deeper problem is that if I deal with already compiled code, and I cannot physically add any
@Order
/Ordered
to the compiled implementations, but I need to add my own to the end of the list.I hope we can collaboratively find a solution. Thank you.
Related Issues
The text was updated successfully, but these errors were encountered: