Skip to content

@Inject within interceptor and feature #312

Answered by shumonsharif
dinosath asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dinosath I assume you are referring to custom interceptors and features; the docs clearly state that:

"Both feature and interceptor classes will be attempted to be loaded via CDI first, and if no CDI beans are available, then the constructor with no parameters will be invoked to instantiate each class."

I would suggest you review the following link thoroughly:
https://quarkus.io/guides/cdi-reference

I did not test it, but in theory, adding both @Startup and @Singleton annotations to your custom interceptor or feature classes should do the trick for you. Please let us know in case that doesn't work.

Replies: 2 comments 6 replies

Comment options

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

Answer selected by dinosath
Comment options

You must be logged in to vote
5 replies
@arolfes
Comment options

@shumonsharif
Comment options

@arolfes
Comment options

@arolfes
Comment options

@shumonsharif
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants