Is it possible to inject a CDI Bean into a static variable in Java EE 6? -
is possible:
@inject @messagetransport(messagetransporttype.sms) public static messagesender messagesender;
i'm getting npe when i'm trying access static variable. wonder, if not possible in general.
thanks in advance.
not done in general because static variable cannot have scope, i.e. it's 1 whole class (read application) , therefore doesn't make sense since every instance try set new value based on current scope.
Comments
Post a Comment