I am using HK2 through Jersey and I want to get @Immediate to work. In the process, I notice that (as it seems) none of the annotations of my services are registered. For example, after expanding my ServiceLocator and looking at my service descriptor annotated with @Singleton, it is still set as @PerLookup. My code to run my application handler is below:
ApplicationHandler handler = new ApplicationHandler(resourceConfig, new AbstractBinder() { ... });
My binder registers the following service:
bindAsContract(ShouldHaveSingletonScope.class);
Looking at my ServiceLocator right after that, I see that the area is not retrieved from the class (still @PerLookup). Is there anything extra I need to specify in order to tell HK2 to parse class annotations? This seems like a pretty standard use case, so I'm missing something.
source share