-
Notifications
You must be signed in to change notification settings - Fork 77
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
@Priority on producers #556
Comments
+1 for both, i.e. |
@Ladicek do you intent do include this in the next release or is it just planning issue? |
this is already supported in Micronaut btw |
I'm not proposing this for 4.0, just figured we should have a tracker for it. |
I was thinking about this and realized that we need to deal with a few things. EnablementCurrently, a producer is enabled if the declaring bean is enabled. We probably want to keep that? That is, if there's a producer that declares a Alternatively, a producer with Ambiguity resolutionCurrently, an ExamplesDeclaring bean is not an alternative@Dependent
class MyBean1 {
@Alternative
@Produces
String producer1() { ... }
@Alternative
@Priority(1)
@Produces
String producer2() { ... }
}
@Dependent
@Priority(2)
class MyBean2 {
@Alternative
@Produces
String producer3() { ... }
@Alternative
@Priority(3)
@Produces
String producer4() { ... }
}
Declaring bean is an alternative@Dependent
@Alternative
class MyBean3 {
@Alternative
@Produces
String producer5() { ... }
@Alternative
@Priority(4)
@Produces
String producer6() { ... }
}
@Dependent
@Alternative
@Priority(5)
class MyBean2 {
@Alternative
@Produces
String producer7() { ... }
@Alternative
@Priority(6)
@Produces
String producer8() { ... }
}
Thoughts? Anything else we need to consider? |
Not a fan either, you need an enabled bean to have a producer discovered on it. An exception might be static producer but I'm not sure that's worth the complexity.
Yes, I was thinking the same - this is akin to how bindings work for interceptors.
Frankly speaking I always found this weird but I get why we want to preserve it. Would it be sensible to impose a deprecation and in some future version require that enabled producers should have the annotation on their respective method/field?
I don't think it's even discovered because the bean declaring it isn't enabled (same for
|
Good point about discovery. The rest of the specification is written such that it doesn't really matter whether the producer is discovered or not -- if it would be discovered, it would still be disabled. I also realized that by allowing |
Makes sense. But frankly, this combination where both the declaring bean and the producer are
👍 |
Now that
@Priority
can be put on anything, we could (should?) support@Priority
on producers (methods? fields? both?).The text was updated successfully, but these errors were encountered: