Is it possible to use Quarkus REST client with JSON deserialization - without RESTEasy server?

Pieterjan Deconinck :

I have a use case for a small Quarkus application that has to able to call a REST endpoint, but that should not run a web server itself.

With the following dependencies, JSON deserialization is not supported:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-jackson</artifactId>
</dependency>

Running the application outputs the following logs:

WARN  [io.qua.res.com.dep.ResteasyCommonProcessor] (build-11) Quarkus detected the need of REST JSON support but you have not provided the necessary JSON extension for this. You can visit https://quarkus.io/guides/rest-json for more information on how to set one.
...
ERROR [...] ProcessingException while creating reply for journey details request: RESTEASY003145: Unable to find a MessageBodyReader of content-type application/json and type class X.

(the warning was added based on this ticket: https://github.com/quarkusio/quarkus/issues/4157)

When changing the configuration to:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>

the REST client Jackson deserialization works, but it also starts a web server.

Is there a way to support Jackson deserialization on the REST client, without running a RESTEasy web server?

Option 1: can I include specific dependencies for this? I played around with the dependencies from quarkus-resteasy-jackson separately, but did not get it to work.

Option 2: is there something missing in the quarkus-jackson dependency? I would assume Jackson serialization on the REST client should be able to be supported without the need to include the full RESTEasy dependency?

Other options? Adding ~10MB RSS memory to a ~20MB application is a lot of overhead percentage wise for a feature that is not used :)

Dmytro Chaban :

You're missing one additional dependency which is resteasy-jackson2-provider Here's combination of libraries that should work:

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-rest-client</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jackson</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson2-provider</artifactId>
    </dependency>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=340861&siteId=1