I joined a project (in scope of work required to implement of DI for custom jackson serializer) and faced a strange bug which took a lot of time to investigate.
There was a jersey test (2.22) which started to fail with:
IllegalStateException("Could not find an active context for " + scope.getName());
It's deep inside ServiceLocatorImpl.
DynamicFeature registered implementation of ContainerResponseFilter with injectable depenency:
@Inject
@Named(OBJECT_MAPPER)
ObjectMapper objectMapper;
Other filters registered right through JerseyConfig had not cause the bug.
I was lucky and found a workaround - the problematic filter can instantiate and resolve this dependency on its own, but I am curious (is it a bug or bug-feature requiring subtle configuration?) and displease misleading error.
Aucun commentaire:
Enregistrer un commentaire