Skip to content

Commit

Permalink
review: use JacksonJsonProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
dimas-b committed Jan 7, 2025
1 parent 5ce1821 commit 03d3890
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 3 additions & 0 deletions integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ dependencies {
implementation(libs.jakarta.ws.rs.api)
implementation(libs.guava)

implementation(platform(libs.jackson.bom))
implementation("com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider")

implementation(platform(libs.iceberg.bom))
implementation("org.apache.iceberg:iceberg-api")
implementation("org.apache.iceberg:iceberg-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.ext.ContextResolver;
import java.io.Serializable;
import java.net.URI;
import org.apache.iceberg.rest.RESTSerializers;
Expand Down Expand Up @@ -83,21 +83,11 @@ public Client client() {
mapper.setPropertyNamingStrategy(new PropertyNamingStrategies.KebabCaseStrategy());
RESTSerializers.registerAll(mapper);

// Note: converting to lambda apparently breaks discovery/injections in the client below
//noinspection Convert2Lambda
ContextResolver<ObjectMapper> mapperProvider =
new ContextResolver<>() {
@Override
public ObjectMapper getContext(Class<?> type) {
return mapper;
}
};

return client =
ClientBuilder.newBuilder()
.readTimeout(5, MINUTES)
.connectTimeout(1, MINUTES)
.register(mapperProvider)
.register(new JacksonJsonProvider(mapper))
.build();
}

Expand Down

0 comments on commit 03d3890

Please sign in to comment.