Description
Sébastien Deleuze opened SPR-14557 and commented
We need to define and standardize how context informations (like annotations for @JsonView
) is passed to the codecs. In 5.0 M1, we temporarily use ResolvableType#getSource()
but that does not work for wrapped return values like Mono<Foo>
since the ResolvableType
is not created from the MethodParameter
+ this is hardcoded and specific.
The original idea was to deal with that in a more flexible and maintainable way by using the Object... hints
parameter of Encoder
and Decoder
. If we chose to go that way:
HttpMessageWriter
andHttpMessageReader
API will have to be updated to pass thisObject... hints
parameter- We should specify what should be in the
Object
parameter, or even perhaps use a more specific type likeCodecContext ...
- We should implement a way to provide this context in a configurable way, maybe with a mechanism similar to
RequestBodyAdvice
/ResponseBodyAdvice
.
The mechanism should allow to pass additional informations needed for serializing / deserializing without wrapping the information like in Spring MVC MappingJacksonValue
to provide a more powerful, flexible and maintainable mechanism.
I plan to provide a PR and will request feedbacks and reviews based on that.
Affects: 5.0 M1
Issue Links:
- Add ResourceRegionHttpMessageWriter [SPR-14664] #19228 Add ResourceRegionHttpMessageWriter ("is depended on by")
- Provide annotated controller hints to codecs and JsonView support [SPR-14693] #19257 Provide annotated controller hints to codecs and JsonView support