{"record":{"id":"7bd27d49089184ec","repo":"quarkusio/quarkus","slug":"usage-of-multiple-methods-using-requestmapping","errorCode":null,"errorMessage":"Usage of multiple methods using '@RequestMapping' is not allowed. Offending method is '<class>#<method>'","messagePattern":"Usage of multiple methods using '@RequestMapping' is not allowed\\. Offending method is '<class>#<method>'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/resteasy/reactive/deployment/SpringWebResteasyReactiveProcessor.java","lineNumber":239,"sourceCode":"                if (target.kind() != AnnotationTarget.Kind.METHOD) {\n                    return;\n                }\n                MethodInfo methodInfo = target.asMethod();\n                Transformation transform = transformationContext.transform();\n                DotName jaxRSMethodAnnotation = null;\n                String path = null;\n                String[] produces = null;\n                String[] consumes = null;\n\n                AnnotationInstance mappingAnnotationInstance = methodInfo.annotation(REQUEST_MAPPING);\n                if (mappingAnnotationInstance != null) {\n                    AnnotationValue methodValue = mappingAnnotationInstance.value(\"method\");\n                    if (methodValue == null) {\n                        jaxRSMethodAnnotation = ResteasyReactiveDotNames.GET;\n                    } else {\n                        String[] methods = methodValue.asEnumArray();\n                        if (methods.length > 1) {\n                            throw new IllegalArgumentException(\n                                    \"Usage of multiple methods using '@RequestMapping' is not allowed. Offending method is '\"\n                                            + methodInfo.declaringClass().name() + \"#\" + methodInfo.name() + \"'\");\n                        }\n                        DotName methodDotName = ResteasyReactiveScanner.METHOD_TO_BUILTIN_HTTP_ANNOTATIONS.get(methods[0]);\n                        if (methodDotName == null) {\n                            throw new IllegalArgumentException(\n                                    \"Unsupported HTTP method '\" + methods[0] + \"' for @RequestMapping. Offending method is '\"\n                                            + methodInfo.declaringClass().name() + \"#\" + methodInfo.name() + \"'\");\n                        }\n                        jaxRSMethodAnnotation = methodDotName;\n                    }\n                } else {\n                    if (methodInfo.hasAnnotation(GET_MAPPING)) {\n                        jaxRSMethodAnnotation = ResteasyReactiveDotNames.GET;\n                        mappingAnnotationInstance = methodInfo.annotation(GET_MAPPING);\n                    } else if (methodInfo.hasAnnotation(POST_MAPPING)) {\n                        jaxRSMethodAnnotation = ResteasyReactiveDotNames.POST;\n                        mappingAnnotationInstance = methodInfo.annotation(POST_MAPPING);","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/resteasy/reactive/deployment/SpringWebResteasyReactiveProcessor.java#L221-L257","documentation":"In the RESTEasy Reactive Spring Web extension, @RequestMapping is translated to a concrete JAX-RS HTTP verb annotation (@Get, @Post, ...). Spring allows @RequestMapping to list several methods (e.g. {GET, POST}), but the Quarkus translation produces exactly one annotation, so an array with more than one HTTP method is rejected at build time.","triggerScenarios":"Annotating a resource method with @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}) or any multi-element method array.","commonSituations":"Direct ports of Spring controllers that intentionally accepted multiple verbs on one endpoint.","solutions":["Split the endpoint into separate methods, one per HTTP verb, each with a single-element @RequestMapping (or @GetMapping/@PostMapping).","Use @GetMapping/@PostMapping shortcuts which carry exactly one verb.","If both verbs truly share logic, extract the shared body into a common method the two endpoint methods call."],"exampleFix":"// before\n@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = \"/items\")\npublic List<Item> items() { ... }\n\n// after\n@GetMapping(\"/items\")\npublic List<Item> getItems() { ... }\n@PostMapping(\"/items\")\npublic List<Item> postItems() { ... }","handlingStrategy":"validation","validationCode":"// ensure single-element method arrays:\n// @RequestMapping(value=\"/x\", method=RequestMethod.GET) // OK\n// @RequestMapping(value=\"/x\", method={GET, POST}) // NOT allowed","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer @GetMapping/@PostMapping shortcut annotations which force one verb.","Split multi-verb Spring endpoints during migration, don't port them as-is."],"tags":["quarkus","spring-web","resteasy-reactive","requestmapping","build-time"],"backgroundTag":"unsupported-annotation-usage","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}