Skip to content

@ResponseBody [SPR-5766] #10436

@spring-projects-issues

Description

@spring-projects-issues

Kenny MacLeod opened SPR-5766 and commented

It seems odd and undesirable that the annotation-style of MVC controllers should only make use of HttpMessageConverter on the request, and not the response. Specifically, @RequestBody -annotated arguments can be resolved using HttpMessageConverter .read(), but there's no support for rendering the response using HttpMessageConverter .write().

This is addressed to some degree in #10100, but I'm focussing here more on writing elegant REST controllers; the controller should be able to take the typed and unmarshalled request body Object, and should be able to return a similarly type Object for marshalling. The ModelAndViewResolver approach suggested in #10100 just doesn't seem right.

Would it be possible for the standard return value resolution logic to consult with any HttpMessageConverters in the context, as happens with @RequestBody annotations? There doesn't seem to be a need for a @ResponseBody annotation.


Affects: 3.0 M3

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions