Closed melloware closed 2 weeks ago
This is doable but will probably require some build time work to introspect the annotations
I actually wonder if its something built into Arc CDI as I am seeing a lot of use of @Priority
in the Quarkus Core but mostly just in tests never in Extensions when doing a select. So I wonder of Instance<XXX>
already respects Priority at the CDI level?
I found this reference for @Priority
. If you search for that annotation on the page.
https://quarkus.io/guides/cdi-reference
it looks like this one https://quarkus.io/guides/cdi-reference#injecting-multiple-bean-instances-intuitively if we inject @All
the list is supposed to respect the Priority.
These sections too: "Default beans can optionally declare @jakarta.annotation.Priority. If there is no priority defined, @Priority(0) is assumed. Priority value is used for bean ordering and during typesafe resolution to disambiguate multiple matching default beans"
https://quarkus.io/guides/cdi-reference#declaring-selected-alternatives
"In CDI, an alternative bean may be selected either globally for an application by means of @Priority, or for a bean archive using a beans.xml descriptor. Quarkus has a simplified bean discovery and the content of beans.xml is ignored.
However, it is also possible to select alternatives for an application using the unified configuration. The quarkus.arc.selected-alternatives property accepts a list of string values that are used to match alternative beans. If any value matches then the priority of Integer#MAX_VALUE is used for the relevant bean. The priority declared via @Priority or inherited from a stereotype is overridden."
Added a unit test showing its not working currently.
@rmanibus i feel like because it seems like Interceptors are executed in the order they are in the List we should respect Priority like other Quarkus Extensions do?
This way users have control over the order of interceptors?
cc @tmulle