Skip to content

Support @JsonFilter on @ResponseBody and ResponseEntity Controller methods [SPR-15164] #19730

Closed
@spring-projects-issues

Description

@spring-projects-issues

doom777 opened SPR-15164 and commented

Just like @JsonView can be used to properly serialize response entities, so should @JsonFilter.

Unfortunately, sometimes @JsonView is not flexible enough. In my app, for example, a response body contains two arrays: objects to add to display, and objects to remove from display. Both Arrays are of the same Type, however objects to add are full objects with all of entities, while objects to remove are just light shells, not fully retrieved from the database for performance issues. They are of same type, but need different serialization. I'd like to register a custom serialization filter with my app-wide object mapper, and use it on the return value from my controller method.


Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions