Skip to content

Commit

Permalink
Force registration of JAXB providers
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Jul 21, 2023
1 parent 4f843d5 commit 55a771d
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down Expand Up @@ -61,6 +63,23 @@ void build(BuildProducer<FeatureBuildItem> feature) {
feature.produce(new FeatureBuildItem(Feature.RESTEASY_JAXB));
}

@BuildStep
void registerProviders(BuildProducer<ResteasyJaxrsProviderBuildItem> jaxrsProviders) {
Set<String> 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<ReflectiveClassBuildItem> reflectiveClass, boolean methods, boolean fields,
String... className) {
reflectiveClass.produce(new ReflectiveClassBuildItem(methods, fields, className));
Expand Down

0 comments on commit 55a771d

Please sign in to comment.