Allow org.springframework.web.bind.annotation.RequestBody on fields (and setters) [SPR-17515] #22047
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Behrang Saeedzadeh opened SPR-17515 and commented
Currently, the correct handler signature to handle a request such as
is something like:
It would be nice if it was possible to merge the
CreateShapeParams
andCreateShapeBody
POJOs into oneCreateShapeRequest
and have a single argument handler method. Then we could rewrite the controller as:This would enable an API structure that is becoming more and more common.
For example, AWS SDKs have
XyzRequest
classes that encapsulate all the request details, from parameters to body and, IIRC, headers too (which meansorg.springframework.web.bind.annotation.RequestHeader
should be allowed on POJO fields and setters too).Response-side annotations (e.g.
ResponseBody
,ResponseStatus
, etc.) should be allowed on fields (and setters) as well.No further details from SPR-17515
The text was updated successfully, but these errors were encountered: