-
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 - introduce the concept of synthetic injection points #31178
Conversation
As I don't have any context about this, I would like to know what the use case you have in mind is |
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java
Outdated
Show resolved
Hide resolved
@geoand Take a look at the second commit (Liquibase extension). |
I see, thanks. Seems like a nice improvement. |
...dent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
Outdated
Show resolved
Hide resolved
...dent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
Show resolved
Hide resolved
4d01556
to
33bf2b1
Compare
independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java
Outdated
Show resolved
Hide resolved
independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/ArcTestClassLoader.java
Outdated
Show resolved
Hide resolved
33bf2b1
to
bb5acbe
Compare
.../test/java/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointInstanceTest.java
Show resolved
Hide resolved
.../test/java/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointMetadataTest.java
Outdated
Show resolved
Hide resolved
.../test/java/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointMetadataTest.java
Outdated
Show resolved
Hide resolved
...st/java/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointUnavailableTest.java
Outdated
Show resolved
Hide resolved
...st/java/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointUnremovableTest.java
Outdated
Show resolved
Hide resolved
...est/java/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointValidationTest.java
Show resolved
Hide resolved
...dent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
Outdated
Show resolved
Hide resolved
bb5acbe
to
bcd4940
Compare
...t-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/SyntheticCreationalContextImpl.java
Outdated
Show resolved
Hide resolved
independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanCreator.java
Outdated
Show resolved
Hide resolved
dabd239
to
b8dcf27
Compare
This pull request is also related to #3699. The difference is that synthetic injection points are validated at build time and considered when detecting unused beans. Of course, it's possible to define a synthetic equivalent of |
I found another use case for synthetic injection point while fixing a test failure - the Hibernate ORM extension. @yrodiere FYI |
I realized yesterday this is fairly close to what we allow in CDI Build Compatible Extensions (except this is quite a bit better), and that made me think about these interesting test cases that I see are not covered by the tests in this PR:
Also, do we want something like this in the synthetic bean disposal function? IIUC, this PR only allows this in the creation function. |
Well, this is something we should probably test.
This should be tested in the
This is rather exotic use case ;-)
This one is interesting.
A test for synthetic
I don't think we want it now. But we could add the support later. |
This comment has been minimized.
This comment has been minimized.
Hm, there's a problem with the Hibernate Reactive extension - it obviously depends on ORM but some of the dependencies of I wonder if it actually makes sense to register the beans for |
c9dc056
to
89effe4
Compare
I've modified the |
No, I don't think people should use the blocking APIs on Hibernate Reactive. FWIW the fact that the Hibernate Reactive extension is depending on the Hibernate ORM extension was IMO a mistake; it's a fact that the Hibernate Reactive project depends on Hibernate ORM core, but it shouldn't pull in its extension as that expresses a different intent for the user. |
This comment has been minimized.
This comment has been minimized.
89effe4
to
d556b2d
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.
LGTM, just a few minor comments, feel free to ignore :-)
independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java
Outdated
Show resolved
Hide resolved
independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/ArcTestClassLoader.java
Outdated
Show resolved
Hide resolved
...ava/io/quarkus/arc/test/buildextension/beans/SyntheticInjectionPointMetadataInvalidTest.java
Outdated
Show resolved
Hide resolved
- a synthetic injection point can be registered by a synthetic bean - this injection point is validated at build time and considered when detecting unused beans - at runtime an injected reference is accessible through the SyntheticCreationalContext
- register Session/EntityManager bean only if JTA is present
d556b2d
to
81168bc
Compare
This comment has been minimized.
This comment has been minimized.
✔️ 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. |
|
BeanConfiguratorBase#addInjectionPoint()
detecting unused beans
SyntheticCreationalContext#getInjectedReference()
methodsTODO