Do you know how to customize the ObjectMapper that is used by Jira’s REST plugin module?
The doco for the REST Plugin Module seems to suggest that providers can be injected:
“The REST plugin module scans your plugin for classes annotated with the
@Provider
and@Path
annotation.”
The constructor of my ContextResolver
does get called. I was expecting the getContext
method to be called during a call to my REST API, but it never is. Do you know why?
@Provider
public class ObjectMapperContextResolver implements ContextResolver<ObjectMapper> {
private final ObjectMapper mapper;
public ObjectMapperContextResolver() {
this.mapper = createObjectMapper();
}
@Override
public ObjectMapper getContext(Class<?> type) {
return mapper;
}
private ObjectMapper createObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new Jdk8Module());
return mapper;
}
}