Hi, do you have plans to add support for header
binding with POJO
?
This issue based on stackoverflow question @RequestHeader not binding in POJO but binding only in variable
IMHO, it would be a useful feature, instead of writing custom and similar HandlerMethodArgumentResolver
Some ideas:
add an annotation for method args - @Header
add an annotation for POJO
fields - @HeaderParam
add support for validation - @Valid
add support for immutable POJO
Thanks
Comment From: lutongzero
related: #23618
Comment From: rstoyanchev
Based on the SO question, you don't need a custom resolver. Just register a Converter
. All method arguments sourced from String-based request values (e.g. @RequestHeader
, @CookieValue
, @PathVariable
, etc) pass through to type conversion from String
to the target type.
Support for such annotations on fields is something different.
Comment From: bankelal
@rstoyanchev - could you please provide with an example that would be most useful for everyone using Converter