Skip to content

CDI Error: Injection of inherited class #31055

Closed Answered by mkouba
rafaelfnx asked this question in Q&A
Discussion options

You must be logged in to vote

From what I researched, it seems that this happens because classes that are annotated with normal scoped beans such as @ApplicationScoped

Correct.

Even though Quarkus magically adds a synthetic no-args constructor, how could it overcome the final field UserRepository? There would be a problem with its initialization as it needs to receive a value, I imagine it might end up being passed a null value..

But Quarkus does not have to overcome anything here - the final field is simply set in the constructor. And if UserRepository is produced by a @Dependent producer then it could be null. There's no issue.

But this generated that error, I tried creating a public constructor method that pas…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@mkouba
Comment options

Answer selected by rafaelfnx
@manovotn
Comment options

@palaknagdaminna
Comment options

@manovotn
Comment options

Comment options

You must be logged in to vote
1 reply
@manovotn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area/arc Issue related to ARC (dependency injection)
4 participants