ManuelB / javaee-openui5-multi-modules-base

MIT License
0 stars 0 forks source link

Missing @inject when using field of type JsonWebToken #2

Open oneturkmen opened 3 years ago

oneturkmen commented 3 years ago

When using a field of type JsonWebToken, the field should also be annotated with @Inject. Alternative way would be to use Provider<JsonWebToken> - in that case, no @Inject is necessary.

Relevant Code: https://github.com/ManuelB/javaee-openui5-multi-modules-base/blob/ae0a7d808df2dda6d350df99a6023b1cbed89d9d/jwt/jaxrs/src/main/java/org/eclipse/microprofile/jwt/jaxrs/JWTSecurityContext.java#L34

Link about JsonWebToken usage:

ManuelB commented 3 years ago

@oneturkmen JWTSecurityContext.java is not a CDI managed bean. Therefore it expects the token as part of the constructor. Actually you are not able to instatiate the class without providing this in the constructor. Does this answer your request?