I am developing a Spring boot application which uses Jackson annotations.
I want to read value of @JsonProperty
from a config, instead of using constant string.
Example JSON input
{"s":12}
Code
I want to read property from my config:
@JsonProperty("${myconfig.fieldAlias.stream}")
private Integer stream;
instead of
@JsonProperty("s")
private Integer stream;
Issue While executing the code above using config:
variable "s" is not identified as stream
unless I use constant @JsonProperty("s")
, which is not desired.
Is it possible to use dynamic JsonProperty
values? If so, what is the proper way to do so?