Skip to content

Commit

Permalink
Disable jersey2 json auto discovery (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnelson authored and troshko111 committed Dec 20, 2019
1 parent c4d212b commit 1ef3c55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public EurekaJersey2ClientImpl(
try {
jerseyClientConfig = clientConfig;
jerseyClientConfig.register(DiscoveryJerseyProvider.class);
// Disable json autodiscovery, since json (de)serialization is provided by DiscoveryJerseyProvider
jerseyClientConfig.property(ClientProperties.JSON_PROCESSING_FEATURE_DISABLE, Boolean.TRUE);
jerseyClientConfig.property(ClientProperties.MOXY_JSON_FEATURE_DISABLE, Boolean.TRUE);
jerseyClientConfig.connectorProvider(new ApacheConnectorProvider());
jerseyClientConfig.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout);
jerseyClientConfig.property(ClientProperties.READ_TIMEOUT, readTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ private void addProxyConfiguration(ClientConfig clientConfig) {
private void addProviders(ClientConfig clientConfig) {
DiscoveryJerseyProvider discoveryJerseyProvider = new DiscoveryJerseyProvider(encoderWrapper, decoderWrapper);
clientConfig.register(discoveryJerseyProvider);

// Disable json autodiscovery, since json (de)serialization is provided by DiscoveryJerseyProvider
clientConfig.property(ClientProperties.JSON_PROCESSING_FEATURE_DISABLE, Boolean.TRUE);
clientConfig.property(ClientProperties.MOXY_JSON_FEATURE_DISABLE, Boolean.TRUE);
}
}
}

0 comments on commit 1ef3c55

Please sign in to comment.