From 6b9ba57a8340c12a0e43e9c241ddf701e5d7ab7a Mon Sep 17 00:00:00 2001 From: mariofusco Date: Thu, 1 Feb 2024 11:15:30 +0100 Subject: [PATCH] wip --- extensions/jackson/deployment/pom.xml | 5 +++++ .../jackson/deployment/JacksonProcessor.java | 4 +++- .../VertxHybridPoolObjectMapperCustomizer.java | 14 ++++++++++++++ extensions/jackson/runtime/pom.xml | 4 ---- .../jackson/runtime/ObjectMapperProducer.java | 2 -- 5 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/VertxHybridPoolObjectMapperCustomizer.java diff --git a/extensions/jackson/deployment/pom.xml b/extensions/jackson/deployment/pom.xml index 68597280eeabb5..eba2ef6a33b367 100644 --- a/extensions/jackson/deployment/pom.xml +++ b/extensions/jackson/deployment/pom.xml @@ -29,6 +29,11 @@ io.quarkus quarkus-jackson + + io.vertx + vertx-core + provided + io.quarkus quarkus-junit5-internal diff --git a/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java b/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java index cdfa668c0ca34c..c85fc7d5893f1a 100644 --- a/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java +++ b/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java @@ -108,9 +108,11 @@ public class JacksonProcessor { List ignoreJsonDeserializeClassBuildItems; @BuildStep - void unremovable(Capabilities capabilities, BuildProducer producer) { + void unremovable(Capabilities capabilities, BuildProducer producer, + BuildProducer additionalProducer) { if (capabilities.isPresent(Capability.VERTX_CORE)) { producer.produce(UnremovableBeanBuildItem.beanTypes(ObjectMapper.class)); + additionalProducer.produce(AdditionalBeanBuildItem.unremovableOf(VertxHybridPoolObjectMapperCustomizer.class)); } } diff --git a/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/VertxHybridPoolObjectMapperCustomizer.java b/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/VertxHybridPoolObjectMapperCustomizer.java new file mode 100644 index 00000000000000..3d7402fccb3dbc --- /dev/null +++ b/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/VertxHybridPoolObjectMapperCustomizer.java @@ -0,0 +1,14 @@ +package io.quarkus.jackson.deployment; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.quarkus.jackson.ObjectMapperCustomizer; +import io.vertx.core.json.jackson.HybridJacksonPool; + +public class VertxHybridPoolObjectMapperCustomizer implements ObjectMapperCustomizer { + + @Override + public void customize(ObjectMapper objectMapper) { + objectMapper.getFactory().setRecyclerPool(HybridJacksonPool.getInstance()); + } +} diff --git a/extensions/jackson/runtime/pom.xml b/extensions/jackson/runtime/pom.xml index f997f902f92344..c382137d4dd66a 100644 --- a/extensions/jackson/runtime/pom.xml +++ b/extensions/jackson/runtime/pom.xml @@ -33,10 +33,6 @@ io.quarkus quarkus-arc - - io.vertx - vertx-core - diff --git a/extensions/jackson/runtime/src/main/java/io/quarkus/jackson/runtime/ObjectMapperProducer.java b/extensions/jackson/runtime/src/main/java/io/quarkus/jackson/runtime/ObjectMapperProducer.java index bb47e5817c40ec..0675633a7e99e6 100644 --- a/extensions/jackson/runtime/src/main/java/io/quarkus/jackson/runtime/ObjectMapperProducer.java +++ b/extensions/jackson/runtime/src/main/java/io/quarkus/jackson/runtime/ObjectMapperProducer.java @@ -19,7 +19,6 @@ import io.quarkus.arc.All; import io.quarkus.arc.DefaultBean; import io.quarkus.jackson.ObjectMapperCustomizer; -import io.vertx.core.json.jackson.HybridJacksonPool; @ApplicationScoped public class ObjectMapperProducer { @@ -64,7 +63,6 @@ public ObjectMapper objectMapper(@All List customizers, for (ObjectMapperCustomizer customizer : sortedCustomizers) { customizer.customize(objectMapper); } - objectMapper.getFactory().setRecyclerPool(HybridJacksonPool.getInstance()); return objectMapper; }