quarkusio/quarkus · error · IllegalArgumentException
Usage of multiple methods using '@RequestMapping' is not all
Error message
Usage of multiple methods using '@RequestMapping' is not allowed. Offending method is '<class>#<method>'
What it means
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.
Source
Thrown at extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/resteasy/reactive/deployment/SpringWebResteasyReactiveProcessor.java:239
if (target.kind() != AnnotationTarget.Kind.METHOD) {
return;
}
MethodInfo methodInfo = target.asMethod();
Transformation transform = transformationContext.transform();
DotName jaxRSMethodAnnotation = null;
String path = null;
String[] produces = null;
String[] consumes = null;
AnnotationInstance mappingAnnotationInstance = methodInfo.annotation(REQUEST_MAPPING);
if (mappingAnnotationInstance != null) {
AnnotationValue methodValue = mappingAnnotationInstance.value("method");
if (methodValue == null) {
jaxRSMethodAnnotation = ResteasyReactiveDotNames.GET;
} else {
String[] methods = methodValue.asEnumArray();
if (methods.length > 1) {
throw new IllegalArgumentException(
"Usage of multiple methods using '@RequestMapping' is not allowed. Offending method is '"
+ methodInfo.declaringClass().name() + "#" + methodInfo.name() + "'");
}
DotName methodDotName = ResteasyReactiveScanner.METHOD_TO_BUILTIN_HTTP_ANNOTATIONS.get(methods[0]);
if (methodDotName == null) {
throw new IllegalArgumentException(
"Unsupported HTTP method '" + methods[0] + "' for @RequestMapping. Offending method is '"
+ methodInfo.declaringClass().name() + "#" + methodInfo.name() + "'");
}
jaxRSMethodAnnotation = methodDotName;
}
} else {
if (methodInfo.hasAnnotation(GET_MAPPING)) {
jaxRSMethodAnnotation = ResteasyReactiveDotNames.GET;
mappingAnnotationInstance = methodInfo.annotation(GET_MAPPING);
} else if (methodInfo.hasAnnotation(POST_MAPPING)) {
jaxRSMethodAnnotation = ResteasyReactiveDotNames.POST;
mappingAnnotationInstance = methodInfo.annotation(POST_MAPPING);View on GitHub (pinned to e1c734241f)
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.
Example fix
// before
@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/items")
public List<Item> items() { ... }
// after
@GetMapping("/items")
public List<Item> getItems() { ... }
@PostMapping("/items")
public List<Item> postItems() { ... } Defensive patterns
Strategy: validation
Validate before calling
// ensure single-element method arrays:
// @RequestMapping(value="/x", method=RequestMethod.GET) // OK
// @RequestMapping(value="/x", method={GET, POST}) // NOT allowed Prevention
- Prefer @GetMapping/@PostMapping shortcut annotations which force one verb.
- Split multi-verb Spring endpoints during migration, don't port them as-is.
When it happens
Trigger: Annotating a resource method with @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}) or any multi-element method array.
Common situations: Direct ports of Spring controllers that intentionally accepted multiple verbs on one endpoint.
Related errors
- Unsupported HTTP method '<method>' for @RequestMapping. Offe
- The combination of '@${annotationName}' and '@ServerRequestF
- The combination of '@${annotationName}' and '@ServerExceptio
- Parameter type <type> is being used multiple times in method
- Parameter type <type> is not supported for method<method> of
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/7bd27d49089184ec.
Report an issue: GitHub.