From 198a6831d4850708ec69a96d6ff3854f72d6f23e Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 2 Sep 2024 10:11:09 +0300 Subject: [PATCH] Register all resource classes for reflection when ResourceInfo is used Fixes: #42919 --- .../server/deployment/ResteasyReactiveProcessor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java b/extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java index 0e29b0bfb5e35..53c3bb8cfda23 100644 --- a/extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java +++ b/extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java @@ -9,6 +9,7 @@ import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.LEGACY_PUBLISHER; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.MULTI; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.PUBLISHER; +import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.RESOURCE_INFO; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.REST_MULTI; import java.io.File; @@ -127,6 +128,7 @@ import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem; import io.quarkus.arc.deployment.BeanContainerBuildItem; +import io.quarkus.arc.deployment.BeanDiscoveryFinishedBuildItem; import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.arc.deployment.UnremovableBeanBuildItem; import io.quarkus.arc.runtime.BeanContainer; @@ -1146,6 +1148,7 @@ public void additionalReflection(BeanArchiveIndexBuildItem beanArchiveIndexBuild List messageBodyReaderBuildItems, List messageBodyWriterBuildItems, ResourceInterceptorsBuildItem resourceInterceptorsBuildItem, + BeanDiscoveryFinishedBuildItem beanDiscoveryFinishedBuildItem, BuildProducer producer) { List resourceClasses = setupEndpointsResult.getResourceClasses(); IndexView index = beanArchiveIndexBuildItem.getIndex(); @@ -1197,7 +1200,10 @@ public void additionalReflection(BeanArchiveIndexBuildItem beanArchiveIndexBuild serializersRequireResourceReflection = true; } - if (serializersRequireResourceReflection) { + boolean resourceInfoUsed = beanDiscoveryFinishedBuildItem.getInjectionPoints().stream() + .anyMatch(i -> RESOURCE_INFO.equals(i.getRequiredType().name())); + + if (serializersRequireResourceReflection || resourceInfoUsed) { producer.produce(ReflectiveClassBuildItem .builder(resourceClasses.stream().map(ResourceClass::getClassName).toArray(String[]::new)) .reason(getClass().getName())