diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/injection/ContextProducers.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/injection/ContextProducers.java index 3b27c08ab4f30..06318c42c1c2d 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/injection/ContextProducers.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/injection/ContextProducers.java @@ -19,6 +19,7 @@ import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; import org.jboss.resteasy.reactive.server.jaxrs.ResourceContextImpl; import org.jboss.resteasy.reactive.server.jaxrs.SseImpl; +import org.jboss.resteasy.reactive.server.mapping.RuntimeResource; import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; /** @@ -86,13 +87,25 @@ Providers providers() { @RequestScoped @Produces ResourceInfo resourceInfo() { - return getContext().getTarget().getLazyMethod(); + RuntimeResource target = getTarget(); + if (target != null) { + return target.getLazyMethod(); + } + return SimpleResourceInfo.NullValues.INSTANCE; } @RequestScoped @Produces SimpleResourceInfo simplifiedResourceInfo() { - return getContext().getTarget().getSimplifiedResourceInfo(); + RuntimeResource target = getTarget(); + if (target != null) { + return target.getSimplifiedResourceInfo(); + } + return SimpleResourceInfo.NullValues.INSTANCE; + } + + private RuntimeResource getTarget() { + return getContext().getTarget(); } @ApplicationScoped