-
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
Quarkus/Gradle/Application class CDI issue - Injected variable is null during test step #17441
Comments
This is a limitation of JAX-RS, you can't inject stuff via CDI into a JAX-RS Application class |
@geoand That sounds odd. I have several Helidon based services running with injected stuff in the JAX-RS application class. |
Sure, I'm not saying it can't be done technically. What I am saying is that because reads this class at build time, injection does not work |
@geoand Do you mean that Quarkus reads this class at build time? |
Yes, for RESTEasy Reactive at least. For RESTEasy Classic, I am not sure, but in any case it's likely read too early for CDI to work |
Ok - Thanks a lot for the very quick responses :) |
I have a opened a PR to make this a build time error in RESTEasy Reactive. |
Fail at build time if @Inject is used in JAX-RS Application class
Describe the bug
During the test step of gradle the test fails with a nullpointer exception on the injected variable in the Application class.
To Reproduce
reproducer.zip
Steps to reproduce the behavior:
Environment (please complete the following information):
Output of
java -version
Java version "11.0.10" 2021-01-19 LTS
Quarkus version or git rev
Quarkus version 1.13.4.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 6.8.3
The text was updated successfully, but these errors were encountered: