@ Uso de anotação imediata em Jersey2
Eu tenho um problema semelhante ao que foi levantado aqui:Como faço para que meus pontos de extremidade Jersey 2 sejam inicializados ansiosamente na inicialização?
Mas um pouco mais abaixo na linha. Posso carregar meu recurso imediatamente, mas quando tento usá-lo chamando o URL REST, recebo o seguinte rastreamento de pilha.
java.lang.IllegalStateException: Could not find an active context for org.glassfish.hk2.api.Immediate
2. java.lang.IllegalStateException: While attempting to create a service for
SystemDescriptor(
implementation=com.service.MyResource
contracts={com.service.MyResource}
scope=org.glassfish.hk2.api.Immediate
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=
rank=0
loader=null
proxiable=null
proxyForSameScope=null
analysisName=null
id=150
locatorId=0
identityHashCode=1249600275
reified=true) in scope org.glassfish.hk2.api.Immediate an error occured while locating the context
Minha classe TResource é anotada assim:
@Immediate
@Path("/test/v1")
public class TResource {
Meu servidor baseado no Grizzly está configurado da seguinte maneira:
ResourceConfig rc = new ResourceConfig()
.packages(true,
"com.mystuff"
)
.property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");
HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create(base_uri), rc);
ApplicationHandler handler = new ApplicationHandler(rc);
ServiceLocatorUtilities.enableImmediateScope(handler.getServiceLocator());
Qualquer orientação seria muito apreciada! Saúde, Phil