Skip to content

Spring Core Conversion should support jackson @JsonValue or @JsonCreator #35200

@thomascaillier

Description

@thomascaillier

Hello !

I was expecting my Spring web controller to be able to convert a string parameter to an enum by using the jackson @JsonValue or @JsonCreator behavior.

Then i saw that org.springframework.core.convert.support.StringToEnumConverterFactory.StringToEnum just use Enum::valueOf.

What do you think ? Shouldn't default behavior be aware of those jackson annotations for a better conversion ?

It could either be another converter used by default (like StringToJsonEnumConverterFactory) or an update of the actual.

You can check at this project that reproduce the issue, with the associated failing tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions