diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/RequestDeserializeHandler.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/RequestDeserializeHandler.java index 768e1612ab778..e6b3a0b7379e0 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/RequestDeserializeHandler.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/RequestDeserializeHandler.java @@ -47,6 +47,7 @@ public RequestDeserializeHandler(Class type, Type genericType, List ShrinkWrap.create(JavaArchive.class) - .addClasses(TestResource.class)); + .addClasses(TestResource.class, TestInterceptor.class, TestRequestScopedBean.class)); @Test void testSmallRequestForNonBlocking() { @@ -81,4 +88,29 @@ public Boolean blocking(String request) { } } + + // the interceptor is used in order to test that a request scoped bean works properly no matter what thread the payload is read from + + @Provider + public static class TestInterceptor implements ReaderInterceptor { + + @Inject + protected TestRequestScopedBean testRequestScopedBean; + + @Override + public Object aroundReadFrom(final ReaderInterceptorContext context) throws IOException, WebApplicationException { + var entity = context.proceed(); + testRequestScopedBean.log((String) entity); + return entity; + } + } + + @RequestScoped + public static class TestRequestScopedBean { + + public void log(final String ignored) { + + } + } + }