From 55a771d85375b1891df01ab793e8a69c70b57c5b Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Fri, 21 Jul 2023 17:54:09 +0100 Subject: [PATCH] Force registration of JAXB providers --- .../deployment/ResteasyJaxbProcessor.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/extensions/resteasy-classic/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java b/extensions/resteasy-classic/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java index e6d430d099d0e..e4ce30d18ac18 100644 --- a/extensions/resteasy-classic/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java +++ b/extensions/resteasy-classic/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Set; import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; @@ -20,6 +21,7 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.jaxb.deployment.JaxbClassesToBeBoundBuildItem; +import io.quarkus.resteasy.common.spi.ResteasyJaxrsProviderBuildItem; public class ResteasyJaxbProcessor { @@ -61,6 +63,23 @@ void build(BuildProducer feature) { feature.produce(new FeatureBuildItem(Feature.RESTEASY_JAXB)); } + @BuildStep + void registerProviders(BuildProducer jaxrsProviders) { + Set providers = Set.of( + "org.jboss.resteasy.plugins.providers.SourceProvider", + "org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlSeeAlsoProvider", + "org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlRootElementProvider", + "org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider", + "org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider", + "org.jboss.resteasy.plugins.providers.jaxb.CollectionProvider", + "org.jboss.resteasy.plugins.providers.jaxb.MapProvider", + "org.jboss.resteasy.plugins.providers.jaxb.XmlJAXBContextFinder"); + + for (String provider : providers) { + jaxrsProviders.produce(new ResteasyJaxrsProviderBuildItem(provider)); + } + } + private void addReflectiveClass(BuildProducer reflectiveClass, boolean methods, boolean fields, String... className) { reflectiveClass.produce(new ReflectiveClassBuildItem(methods, fields, className));