-
Notifications
You must be signed in to change notification settings - Fork 1k
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 behaviour of @DefaultImplementation consistent #10820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is a good idea but we should document this in the "Default Implementation" section of the docs. We should mention that @primary still has precedence over @DefaultImplementation
inject/src/main/java/io/micronaut/context/DefaultBeanContext.java
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
Personally, I don't like the idea of I think this will not work correctly in a case |
right, I added this because the current implementation is confusing and because Guice supports this concept https://github.com/google/guice/blob/2b37f020862e45be58f246a63c2f97fdaff0d433/core/test/com/google/inject/ImplicitBindingTest.java#L54 The example you mention should work fine, we just need to make sure the implementing type matches the type to be injected. If we don't agree to this change then I can maybe implement is some other way in the Guice bridge, but I would then suggest we deprecate |
I'm OK with this. Does it work to not have any scope defined on the implementation like it's in the JavaDoc of |
yes it does |
Cherry picks the javadoc improvements done in #10820 to `Ordered`
Cherry picks the javadoc improvements done in #10820 to `Ordered`
The
@DefaultImplementation
annotation is currently confusing since it doesn't influence bean selection but only the result of@Replaces
. This PR makes it so that the annotation can also be used to control bean selection which makes it more logical and less confusing.