Skip to content

Allow specifying @JacksonInject does not fail when there's no corresponding value #3072

Closed
@retrodaredevil

Description

@retrodaredevil

When something is annotated with @JacksonInject, if the ObjectMapper doesn't have injectable values set, it will fail with Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No 'injectableValues' configured, cannot inject value with id [<name of injectable value>]. And there's a different error if the value doesn't exist on the injectable values object.

I'd like to be able to annotation things with @JacksonInject like so:

@JacksonInject(value = "myValue", optional = true)
private String myValue;

Additionally, there could also be a DeserializationFeature called something like FAIL_ON_UNKNOWN_INJECT_VALUE that defaults to true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.20Issues planned at 2.20 or later

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions