-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make @DefaultBean work with @Priority #37042
Comments
Note that if user defines their own bean extending Apart from the obvious approach of adding the priority functionality, two things come to my mind.
One thing you could do is add
|
Yes, if But overall I think that it's a good idea to support multiple default beans sorted by priority. |
The feature request kinda makes sense, when you think of |
Right, I am not against it either, just trying to help find a solution using what we already have :) BTW, if we want to add this, we could also just add the priority directly as a value on the |
We got rid of Ah and yes, I agree vetoing |
Thanks everyone for the answers and suggestions! Unfortunately, the framework I mentioned is not a Quarkus extension, so vetoing is not an option. |
You might be able to achieve the same via CDI extension, in CDI Lite those are build compatible extensions and you can use the |
Description
Let's say I work on a small framework which can be used by an application by depending on several different dependencies (
framework-core
orframework-advanced
), based on the application needs.The
framework-core
dependency contains these two classes:The
framework-advanced
dependency depends onframework-core
and contains this class:Right now, when an app depends on
framework-advanced
, Arc will complain because it cannot determine which ofCoreFeature
andAdvancedFeature
should be injected inInternalFrameworkService
. I would like this to work using@Priority
onCoreFeature
andAdvancedFeature
so that Arc injects the one with the highest priority, just like it does with@Alternative
.Why do I need
@DefaultBean
? Because I want the users of the framework to be able to do this:Or that:
And override anything that comes from the framework with whatever they need to implement.
This whole thing can work without
@Priority
working with@DefaultBean
, but the users of the framework have to use@Alternative
alongside with@Priority
on their class, which is something I'd like to avoid.Implementation ideas
Make
@DefaultBean
and@Priority
work similarly to@Alternative
and@Priority
.The text was updated successfully, but these errors were encountered: