Jakson added ConstructorDetector
support in https://github.com/FasterXML/jackson-databind/issues/1498. It would be nice if this could be configured in application.properties
in a similar way to other Jackson features.
Comment From: snicoll
Just a note that ConstructorDetector
isn't an enum as I thought it would be. It's actually a POJO with three attributes: a mode (enum) for single arg constructor, whether a @JsonCreator
is required, and whether constructors for JDK types can be considered. It looks like the latter is fairly advanced so I am wondering if we should rather expose the enum only and let more advanced use case to be configured via a customizer.
Comment From: philwebb
I'm not really sure if we should use the SingleArgConstructor
enum, or declare a new one that mirrors the statics in ConstructorDetector
. I do think we shouldn't try to cover all the with...
methods in properties.
Comment From: philwebb
I'm kind of leaning towards a spring.jackson.constructor-detector
property with default
, use-property-based
, use-delegating
and explicit-only
as values.
Comment From: snicoll
We need a new enum anyway as this feature has been introduced in Jackson 2.12 and we still have support for 2.11