我正在尝试在quarkus中使用Amadeus SDK。我已经用Spring Boot运行了SDK,并且API工作正常。对Amadeus SDK的要求是使用GSON作为JSON映射库。因此,在Spring Boot中需要进行以下配置。
spring.mvc.converters.preferred-json-mapper=gson但是我找不到如何在quarkus中使用GSON。没有适用于quarkus的resteasy-client-gson扩展,这是因为我在使用Amadeus Java SDK时遇到了下面的异常。
Could not write JSON: JsonObject; nested exception is com.fasterxml.jackson.databind.JsonMappingException: JsonObject (through reference chain: com.amadeus.resources.FlightOfferSearch[0]->com.amadeus.resources.FlightOfferSearch["response"]->com.amadeus.Response["result"]->com.google.gson.JsonObject["asBoolean"]有没有办法解决这个问题,并将GSON配置为使用quarkus的Amadeus SDK的Json映射库
发布于 2021-10-11 06:33:19
Quarkus中没有内置的GSON扩展,但您可以通过实现基于GSON的MessageBodyReader和MessageBodyWriter,使Quarkus使用GSON作为REST API层。
您可以查看this answer了解更多详细信息
https://stackoverflow.com/questions/69514004
复制相似问题