-
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
Beans injected in tests are removed as unused #1749
Comments
@sarxos Ok, so we should clarify that this problem occurs iff an application bean ( @geoand Yes, your proposal could one way how to address this issue. The other way would be to register |
You are the expert, whatever you think is best :). If you don't have enough time to fix it today, I can most likely squeeze in whichever fix you prefer over the weekend. |
@mkouba Yes, I confirm. This issue appears if and only if my CDI bean is |
@mkouba I do not insist on fixing this, but this behaviour should be described in more details since I spent some time trying to narrow it down and I assume integrators to have similar problems when working with ArC's CDI. I can prepare PR against https://github.com/quarkusio/quarkusio.github.io/blob/develop/_guides/cdi-reference.adoc if you like. Quarkus is developed under Red Hat, am I correct? Do you require signing contributors agreement or similar like the guys from Oracle? |
@sarxos I agree that we should definitely improve the docs in this area. There is already an issue: #1669. I also think that should fix this. @geoand I lean towards the "register Let's think about it over the weekend and we can decide early next week. @sarxos Re contributors agreement - I'm not aware of any agreement. It's just an ASL2 open source project. |
👍 |
@mkouba I am thinking for the time being we should just go with the straight-forward of having |
@geoand Yes, makes sense. Would you like to send a PR? BTW we should probably also check the JUnit4 runner. |
@mkouba Sure thing, I will take care of it either tonight or tomorrow morning :) |
Allow beans to be injected in tests even if they aren't used in the application
Thank you @geoand :) |
You are welcome @sarxos ! |
Hello @mkouba,
This is in regards to our conversation from Zulip.
Beans injected into a test are automatically removed.
I have a service:
And a test:
Since
TestService
has bean defining annotation it is automatically discovered. And since it's@Inject
-ed into test, it should not be autoremoved. But it's removed and test failsThe workarounds so far:
quarkus.arc.remove-unused-beans=false
inapplication.preferences
@Singleton
:A failure log:
The text was updated successfully, but these errors were encountered: