Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force registration of JAXB providers #34925

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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