-
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
Arc - Revisit BeanContainer API #35776
Conversation
/cc @Sanne (hibernate-orm), @brunobat (opentelemetry), @ebullient (metrics), @gsmet (hibernate-orm), @jmartisk (metrics), @radcortez (opentelemetry), @yrodiere (hibernate-orm) |
independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ArcContainerImpl.java
Outdated
Show resolved
Hide resolved
Sorry for the label explosion, the PR changes those extensions only in terms of replacing now-deprecated Arc API call(s). |
I've reworked the PR after discussion with Martin over zulip - it avoid creating more deprecations and instead changes currently used methods. We would cause breaking changes anyway and this way it is less intrusive as most extensions (including our own in core repo) should "just work" with this approach as well. |
This comment has been minimized.
This comment has been minimized.
Famous last words :] |
Indeed :-D |
Alright, it turns out the default behavior - fallback to instantiation via no-args ctor - is way more common than I anticipated. With that in mind, we might instead consider changing the javadoc, keeping the default instantiation and the current method (I assume more extensions out in the wild might use that) and introducing a new method, that will use a custom
|
97d48fa
to
a3a52a3
Compare
I've updated the PR as per my suggestion above, let's see what CI thinks about it now :) |
a3a52a3
to
de5cf63
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
de5cf63
to
4f2aa80
Compare
Also, in RR there is a I am not sure what was the original intention of this but right now the |
This comment has been minimized.
This comment has been minimized.
This was introduced in #19829 with the intent of making the error message better (described in #19750). |
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. |
Fixes #35744
A draft of changes for
BeanContainer
API - some of these are breaking in behavior although they were already dubious in how they worked because we had conflicting javadoc and implementation.The
BeanContainer#beanInstanceFactory
method stays in terms of what it does and it now has a javadoc documenting this behavior (i.e. no longer says it can returnnull
). There is also a new variant allowing users to specify a custom fallbackFactory
implementation that can be used to perform arbitrary fallack in case the bean isn't present.The
BeanContainer#beanInstance
method which is used in our own extensions remains in place but also changes in that it can no longer returnnull
- instead it is a proper CDI lookup dealing with ambiguous and unsatisfied dependencies. Extensions looking to implement fallbacks in case the beans are missing can leverage thebeanInstanceFactory
method, or just accessArcContainer
and query for a bean via dynamic resolution.Last but not least, formerly deprecated methods (deprecated since version 2.14) are now deleted.