Probably not Kotlin related but I think RequestParam does not use Jackson but Spring converters instead. If you use RequestBody then Jackson is used
✅ 1
v
Václav Škorpil
06/21/2022, 12:14 PM
Ohhh, that might be that case. And is it possible to use set it up to use jackson?
j
Jukka Siivonen
06/21/2022, 12:16 PM
I don't think it would make any sense because request parameters and actual body are different things
🙏 1
🆗 1
Jukka Siivonen
06/21/2022, 12:18 PM
So if you want this enum to work as a standalone req parameter and also inside body object you need Jackson configuration/annotation and custom Spring converter
✅ 1
v
Václav Škorpil
06/21/2022, 12:22 PM
Also is there a Spring documentation that explains how it works in detail?
p
pi0id
06/21/2022, 1:14 PM
For a regular conversion, Spring is able to initialize your param without any helping converter. In your case, a custom conversion is needed from
name
to
NAME
and from
registrationNumber
to
REGISTRATION_NUMBER
.
So, create a class annotated with
@Component
that implements Converter interface. You just have to implement the required method