Why Jackson in Quarkus can't deserialize a GeoLatte geometry?

Viewed 7

In Quarkus I'm trying to use GeoLatte Geometry in a DTO as follows:

@Data
@Accessors(chain = true)
@RegisterForReflection
public class TrackDTO {

    ...

    @JsonSerialize(using = GeometrySerializer.class)
    @JsonDeserialize(using = GeometryDeserializer.class)
    private Geometry<C2D> geom;

    ...
}

I created a JacksonConfig class too:

@Singleton
public class JacksonConfig implements ObjectMapperCustomizer {

    @Override
    public void customize(ObjectMapper objectMapper) {
        objectMapper.registerModule(new GeolatteGeomModule());
    }
}

but If I try to push a geometry:

http http://localhost:8080/tracks \
        geom:="{ \"type\": \"point\", \"coordinates\": [ 1, 1 ] }"

It says me that:

2022-09-24 23:38:51,933 SEVERE [org.ecl.yas.int.Unmarshaller] (executor-thread-0) Unable to deserialize property 'geom' because of: Cannot create instance of a class: class org.geolatte.geom.Geometry, No default constructor found.

In my build.gradle I have these dependencies:

dependencies {
    implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
    implementation 'io.quarkus:quarkus-smallrye-health'
    implementation 'io.quarkus:quarkus-resteasy-jsonb'
    implementation 'io.quarkus:quarkus-hibernate-orm-panache'
    implementation 'io.quarkus:quarkus-resteasy'
    implementation 'io.quarkus:quarkus-resteasy-jaxb'
    implementation 'io.quarkus:quarkus-resteasy-jackson'
    implementation 'io.quarkus:quarkus-spring-data-jpa'
    implementation 'io.quarkus:quarkus-jdbc-postgresql'
    implementation 'io.quarkus:quarkus-arc'
    implementation 'io.quarkus:quarkus-smallrye-openapi'
    testImplementation 'io.quarkus:quarkus-junit5'

    implementation 'com.github.fmcejudo:quarkus-eureka:0.0.14'

    implementation 'net.postgis:postgis-jdbc:2021.1.0'
//    implementation 'org.hibernate:hibernate-spatial:6.1.3.Final'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4'
    implementation 'com.vladmihalcea:hibernate-types-55:2.19.2'

    implementation 'org.geolatte:geolatte-geom:1.8.2'
    implementation 'org.geolatte:geolatte-geojson:1.8.2'
}

How can I solve it?

0 Answers
Related