Joe
04/30/2021, 8:02 PM@JacksonInject
. I've got it working like this:
class ClassToDeserialize {
@JacksonInject
private val dependency: ThirdPartyUndeserializableObject? = null
@JsonPropery
private val simpleValue: String
/// ... etc
}
To avoid nullability (and since I don't really have an instance of the dependency I can assign statically), I'd like to use constructor injection instead:
class ClassToDeserialize(
@JacksonInject
private val dependency: ThirdPartyUndeserializableObject
) {
@JsonPropery
private val simpleValue: String
/// ... etc
}
but doing so still results in jackson trying to manage the dependency prior to using the injected value (manifests as Invalid definition for property
since the class isn't json deserializable due to conflicting setters within the third party class). Adding a @JsonIgnore
doesn't appear to have any effect, either. Is there a way to do this?@JacksonInject(useInput = OptBoolean.FALSE)
plus a change in jackson 2.12.4: https://github.com/FasterXML/jackson-databind/pull/3146