Is there anyway to configure JacksonJsonProvider to be used as a
singleton for the client and the server?
I have the following RestApplication class but no matter what I do it
overrides the provider I supply with new instances of
JacksonJsonProvider. I thought components would only be discovered in
the packages I specified with the "packages()" method?
public class RestApplication extends ResourceConfig {
public RestApplication() {
register( new GZipEncoder() );
register( getJsonProvider(), MessageBodyReader.class,
MessageBodyWriter.class );
register( new JsonParseExceptionMapper() );
register( new JsonMappingExceptionMapper() );
packages( "com.myapp.rest.service" );
}
private static final JacksonJsonProvider provider =
new JacksonJsonProvider(
new ObjectMapper().registerModule( new AfterburnerModule() ) );
public static JacksonJsonProvider getJsonProvider() {
return provider;
}
}