-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix issue with default beans resolution #20263
Fix issue with default beans resolution #20263
Conversation
Well, the behavior of Use case 1 - ambiguous dependency exists, but no alternative beans, e.g. Use case 2 - ambiguous dependency exists, some alternative beans, e.g. Now if My point is that we should probably define the desired behavior first and document this in the |
Well at the moment the behavior is inconsistent. If you have 2 beans, one a default and one not then only the non-default bean will be returned. If you have 3 beans, one default and 2 not then all 3 are returned. Security relies on this behavior to allow things to be overridden by the user, however in all the tests we were only adding a single new implementation so this was not picked up. |
@mkouba @stuartwdouglas If you go over them, you'll see that the general idea is that you don't throw unsatisfied/ambig exception but you perform bean resolution taking alternatives into consideration. Therefore:
This should return
This should return
This can IMO logically follow the train of thoughts above. E.g. you only ever list default bean if it hasn't been replaced by either standard bean or enabled alternative. |
Yes, it is. My point is that this fix will make it "less inconsistent" but still inconsistent. I think that we should copy the behavior from Weld, i.e. return the set of "disambiguated beans". I.e. attempt to resolve ambiguities and return the "best" result we have. |
@stuartwdouglas Let me just try to show what I mean on top of your commit... |
I personally think that this PR makes sense, but I wonder -- is it possible to have more than 1 default bean for given bean type? :-) |
In theory yes, or at least it's not forbidden. And I will have this use case covered in my commit. |
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 0bf9e56
Failures⚙️ Initial JDK 11 Build #- Failing: independent-projects/arc/runtime
! Skipped: core/test-extension/deployment core/test-extension/runtime devtools/bom-descriptor-json and 613 more 📦 independent-projects/arc/runtime✖ |
0bf9e56
to
0a639a9
Compare
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.
This is now IMO behaving accordingly to specification plus takes care of default beans in a sensible way.
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 0a639a9
Full information is available in the Build summary check run. Failures⚙️ Devtools Tests - JDK 11 #- Failing: integration-tests/devtools
📦 integration-tests/devtools✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-java-030fd1bc-d446-41aa-b5e5-5d3f385dcaa2✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-kotlin-69b418f6-b95b-4600-b164-1cd4852339b4✖
⚙️ Devtools Tests - JDK 11 Windows #- Failing: integration-tests/devtools
📦 integration-tests/devtools✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-java-92a33d7a-15d6-472b-8664-b06637d26e21✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-kotlin-60670209-3616-429d-ace1-be4b5219c22b✖
⚙️ Gradle Tests - JDK 11 #- Failing: integration-tests/gradle
📦 integration-tests/gradle✖
⚙️ Gradle Tests - JDK 11 Windows #- Failing: integration-tests/gradle
📦 integration-tests/gradle✖
⚙️ JVM Tests - JDK 11 #- Failing: extensions/smallrye-health/deployment integration-tests/spring-web
! Skipped: docs extensions/agroal/deployment extensions/elytron-security-jdbc/deployment and 127 more 📦 extensions/smallrye-health/deployment✖
📦 integration-tests/spring-web✖
⚙️ JVM Tests - JDK 11 Windows #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
⚙️ JVM Tests - JDK 16 #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
⚙️ Native Tests - Spring #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
|
0a639a9
to
436ed76
Compare
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 436ed76
Full information is available in the Build summary check run. Failures⚙️ Devtools Tests - JDK 11 #- Failing: integration-tests/devtools
📦 integration-tests/devtools✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-java-fcccd14c-4d87-49ed-bc67-dd8cffe27996✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-kotlin-a62ee875-9e5a-4fc7-9675-04ef1b194a2f✖
⚙️ Devtools Tests - JDK 11 Windows #- Failing: integration-tests/devtools
📦 integration-tests/devtools✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-java-a262014d-0243-4bfd-851e-b8857ebd531e✖
📦 integration-tests/devtools/target/quarkus-codestart-build-test/project-maven-kotlin-ba96a30c-8bf9-4bb4-ab4e-174f6a483f06✖
⚙️ JVM Tests - JDK 11 #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
⚙️ JVM Tests - JDK 11 Windows #- Failing: extensions/amazon-lambda/deployment integration-tests/spring-web
! Skipped: docs extensions/amazon-lambda-http/deployment extensions/amazon-lambda-rest/deployment and 6 more 📦 extensions/amazon-lambda/deployment✖
📦 integration-tests/spring-web✖
⚙️ JVM Tests - JDK 16 #- Failing: extensions/amazon-lambda/deployment integration-tests/spring-web
! Skipped: docs extensions/amazon-lambda-http/deployment extensions/amazon-lambda-rest/deployment and 6 more 📦 extensions/amazon-lambda/deployment✖
📦 integration-tests/spring-web✖
⚙️ Native Tests - Spring #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
|
436ed76
to
d442730
Compare
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building d442730
Full information is available in the Build summary check run. Failures⚙️ JVM Tests - JDK 11 #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
⚙️ JVM Tests - JDK 11 Windows #- Failing: extensions/amazon-lambda/deployment integration-tests/spring-web
! Skipped: docs extensions/amazon-lambda-http/deployment extensions/amazon-lambda-rest/deployment and 6 more 📦 extensions/amazon-lambda/deployment✖
📦 integration-tests/spring-web✖
⚙️ JVM Tests - JDK 16 #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
⚙️ Native Tests - Spring #- Failing: integration-tests/spring-web
📦 integration-tests/spring-web✖
|
@stuartwdouglas Why did you remove my commit? Anyway, those test failures are probably not related - e.g. I wasn't able to reproduce the |
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.
The current fix is not entirely correct.
If there is more than one Foo for Instance<Foo> then default beans are included in the result list. This result in HTTP basic auth always being enabled if there is more than one authenticator.
- also fix HealthCheckDefaultScopeTest
d442730
to
7d7c9fb
Compare
oops, I must have screwed up the rebase, sorry, I have fixed. |
Failing Jobs - Building 7d7c9fb
Full information is available in the Build summary check run. Failures⚙️ Gradle Tests - JDK 11 Windows #- Failing: integration-tests/gradle
📦 integration-tests/gradle✖
|
Test failure is unrelated and flaky (it passes locally for me) |
If there is more than one Foo for Instance then default beans are
included in the result list. This result in HTTP basic auth always being
enabled if there is more than one authenticator.