Closed as not planned
Closed as not planned
Description
Allow @PathVariable
, @RequestParam
, and similar annotations on parameters of functional closures (e.g., Consumer, Function) returned by Spring WebFlux endpoints.
Motivation:
Spring WebFlux’s functional endpoints lack support for annotating closure parameters with @PathVariable
. This forces developers to pass parameters explicitly, making code less concise. For example:
@PutMapping("decrement/{word}")
public Consumer<@PathVariable("word") String> adjustVocabDown(@PathVariable("langId") Long langId) {
return word -> languageService.propVocabularyFreq(langId, changeFrequency.apply(decrement)).accept(word);
}
Supporting annotations in closures would simplify endpoint definitions and align with Spring MVC’s annotation model.
Proposed Solution:
Enable Spring (WebFlux, Web) to process @PathVariable
, @RequestParam
, and @RequestBody
on closure type parameters. Bind request data (e.g., path variables) to these parameters automatically, similar to annotated controllers.