I am using spring boot with jackson to create a rest api. I know that @JsonProperty annotation has defaultValue field.
In
it's javadoc its said:
textual default value defined as metadata. NOTE: core databind does NOT make any use of this value; it is currently only exposed to extension modules.
So I found some modules for jackson on maven central repository, however I couldn't find anyware information about which extension I should use to enable defaultValue handling.
Is there such module?
As per the documentations of JsonProperty , the defaultValue property may be used to document expected default value. They have added this property in version 2.5. And as per their view
It is possible that in future this annotation could be used for value defaulting, and especially for default values of Creator properties,since they support {@link #required()} in 2.6 and above.
As of now till version 2.8 we are not able to use this annotation to set default value. Here we may rely on Java to have default values for member variables.