Skip to content

Commit

Permalink
Merge pull request #34925 from radcortez/fix-13453
Browse files Browse the repository at this point in the history
Force registration of JAXB providers
  • Loading branch information
geoand authored Jul 24, 2023
2 parents 2da3206 + 55a771d commit 65fc7c6
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 65fc7c6

Please sign in to comment.