diff --git a/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java b/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java index 7e08734761b92..add11acc38e61 100644 --- a/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java +++ b/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java @@ -531,8 +531,10 @@ private static boolean collectDeclaredProvidersForMethodAndMediaTypeAnnotation(S AnnotationInstance mediaTypeClassAnnotationInstance = methodTarget.declaringClass() .classAnnotation(mediaTypeAnnotation); if (mediaTypeClassAnnotationInstance != null) { - if (collectDeclaredProvidersForMediaTypeAnnotationInstance(providersToRegister, categorizedProviders, - mediaTypeClassAnnotationInstance.value().asStringArray(), methodTarget)) { + AnnotationValue mediaTypeClassValue = mediaTypeClassAnnotationInstance.value(); + if ((mediaTypeClassValue != null) + && collectDeclaredProvidersForMediaTypeAnnotationInstance(providersToRegister, categorizedProviders, + mediaTypeClassValue.asStringArray(), methodTarget)) { return true; } return false; diff --git a/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/NoProducesValueTest.java b/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/NoProducesValueTest.java new file mode 100644 index 0000000000000..b0482bc96a4d2 --- /dev/null +++ b/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/NoProducesValueTest.java @@ -0,0 +1,38 @@ +package io.quarkus.resteasy.test; + +import static io.restassured.RestAssured.given; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.test.QuarkusUnitTest; + +public class NoProducesValueTest { + + @RegisterExtension + static QuarkusUnitTest runner = new QuarkusUnitTest() + .withApplicationRoot((jar) -> jar + .addClasses(TestResource.class)); + + @Test + public void testSomething() { + given().when().get("/test/hello") + .then().statusCode(200); + } + + @Produces + @Path("test") + public static class TestResource { + + @GET + @Path("hello") + public Response getHello() { + return Response.ok().build(); + } + } +}